diff --git a/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py b/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py index 197261a9..455627f7 100644 --- a/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py +++ b/CodeGenerator/templates/GithubObject.MethodBody.DoRequest.py @@ -14,10 +14,22 @@ {% endif %} {% endif %} +{% if method.request.url_parameters %} + url_parameters = { + {% for parameter in method.request.url_parameters %} + "{{ parameter.name }}": {% include "GithubObject.Concatenation.py" with concatenation=parameter.value only %}, + {% endfor %} + } +{% endif %} + status, headers, data = self.__requester.request( "{{ method.request.verb }}", {% include "GithubObject.Concatenation.py" with concatenation=method.request.url only %}, +{% if method.request.url_parameters %} + url_parameters, +{% else %} None, +{% endif %} {% if method.request.post_parameters %} post_parameters {% else %} diff --git a/IntegrationTest.py b/IntegrationTest.py index 818b09bb..150d6c2a 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -242,11 +242,11 @@ class IntegrationTest: com1.edit( body = "Comment edited by PyGithub" ) self.printList( "Comments", c.get_comments(), lambda c: c.body ) - # def testCreateForkForOrganization( self ): - # o = self.g.get_organization( self.cobayeOrganization ) - # r = self.g.get_user().get_repo( "TestPyGithub" ) - # rf = o.create_fork( r ) - # print r.owner.login + "/" + r.name, "->", rf.owner.login + "/" + rf.name + def testCreateForkForOrganization( self ): + o = self.g.get_organization( self.cobayeOrganization ) + r = self.g.get_user().get_repo( "TestPyGithub" ) + rf = o.create_fork( r ) + print r.owner.login + "/" + r.name, "->", rf.owner.login + "/" + rf.name def testCreateRepoForOrganization( self ): o = self.g.get_organization( self.cobayeOrganization ) diff --git a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index 37b89d9a..dd2c4444 100644 --- a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -913,6 +913,9 @@ { "type": "argument", "value": [ "repo", "name" ] }, { "type": "constant", "value": "/forks" } ], + "url_parameters": [ + { "name": "org", "value": [ { "type": "attribute", "value": [ "login" ] } ] } + ], "information": "status" } } diff --git a/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/JsonDescriptionOfGithubApiV3/description.001.normalized.json index fb6705bc..0ded97b7 100644 --- a/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -5878,8 +5878,21 @@ "value": "/forks" } ], - "information": "status", - "verb": "POST" + "url_parameters": [ + { + "name": "org", + "value": [ + { + "type": "attribute", + "value": [ + "login" + ] + } + ] + } + ], + "verb": "POST", + "information": "status" }, "optional_parameters": [], "type": { diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index be146804..872dba14 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -149,10 +149,13 @@ class Organization( object ): ) def create_fork( self, repo ): + url_parameters = { + "org": str( self.login ), + } status, headers, data = self.__requester.request( "POST", "https://api.github.com/repos/" + str( repo.owner.login ) + "/" + str( repo.name ) + "/forks", - None, + url_parameters, None ) return Repository.Repository( self.__requester, data, lazy = True )