diff --git a/IntegrationTest.py b/IntegrationTest.py index 92b63674..7047a412 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -57,4 +57,4 @@ u = g.get_user() o = g.get_organization( "BeaverSoftware" ) # o.edit( location = "Paris, France" ) -# u.create_repos( name = "TestGithubApi" + str( len( u.get_repos() ) ), description = "Created by a Python script!" ) +# dumpRepository( u.create_repo( name = "TestGithubApi" + str( len( u.get_repos() ) ), description = "Created by a Python script!", has_wiki = False ) ) diff --git a/Reference.md b/Reference.md index f4a66c8a..04b9b073 100644 --- a/Reference.md +++ b/Reference.md @@ -92,7 +92,7 @@ /orgs/:org/repos ================ - GET: `Organization.get_repos()`: list of `Repository` - - POST: `Organization.create_repos( ... )`: `Repository` + - POST: `Organization.create_repo( ... )`: `Repository` /orgs/:org/teams ================ @@ -429,7 +429,7 @@ /user/repos =========== - GET: `AuthenticatedUser.get_repos()`: list of `Repository` - - POST: `AuthenticatedUser.create_repos( ... )`: `Repository` + - POST: `AuthenticatedUser.create_repo( ... )`: `Repository` /user/watched ============= diff --git a/github/GithubObject.py b/github/GithubObject.py index fe10f727..df14d860 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -122,12 +122,12 @@ class ListOfReferences: return obj._github._statusRequest( "GET", obj._baseUrl + "/" + self.__attributeName + "/" + toBeQueried._identity ) == 204 class ListOfObjects: - def __init__( self, attributeName, type, creatable = False ): + def __init__( self, attributeName, type, creatable = False, singularName = None ): self.__attributeName = attributeName self.__type = type self.__getName = "get_" + attributeName if creatable: - self.__createName = "create_" + attributeName + self.__createName = "create_" + ( singularName or attributeName ) else: self.__createName = None diff --git a/github/GithubObjects.py b/github/GithubObjects.py index f6cc5f54..44da2338 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -77,9 +77,9 @@ Repository._addAttributePolicy( ComplexAttribute( "parent", Repository ) ) Repository._addAttributePolicy( ComplexAttribute( "source", Repository ) ) Repository._addAttributePolicy( ListOfReferences( "forks", Repository ) ) -AuthenticatedUser._addAttributePolicy( ListOfObjects( "repos", Repository, creatable = True ) ) +AuthenticatedUser._addAttributePolicy( ListOfObjects( "repos", Repository, creatable = True, singularName = "repo" ) ) NamedUser._addAttributePolicy( ListOfObjects( "repos", Repository ) ) -Organization._addAttributePolicy( ListOfObjects( "repos", Repository, creatable = True ) ) +Organization._addAttributePolicy( ListOfObjects( "repos", Repository, creatable = True, singularName = "repo" ) ) def __repoFromUser( user, name ): return Repository( user._github, { "name": name, "owner": { "login": user.login } }, lazy = False )