fix update/delete/create content return value invalid issue

This commit is contained in:
Enix Yu
2016-06-27 09:52:11 +08:00
parent 9c6f881220
commit a0a4511f29
+10 -3
View File
@@ -1265,7 +1265,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
input=put_parameters
)
return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
return {'content': github.ContentFile.ContentFile(self._requester, headers['content'], data, completed=True),
'commit': github.Commit.Commit(self._requester, headers, data['commit'], completed=True)}
def update_file(self, path, message, content, sha,
branch=github.GithubObject.NotSet,
@@ -1317,7 +1318,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
input=put_parameters
)
return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
return {'commit': github.Commit.Commit(self._requester, headers, data['commit'], completed=True),
'content': github.ContentFile.ContentFile(self._requester, headers, data['content'], completed=True)}
def delete_file(self, path, message, sha,
branch=github.GithubObject.NotSet):
@@ -1327,7 +1329,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
:param message: string, Required. The commit message.
:param sha: string, Required. The blob SHA of the file being replaced.
:param branch: string. The branch name. Default: the repositorys default branch (usually master)
:rtype: None
:rtype: {
'content': :class:`null <github.GithubObject.NotSet>`:,
'commit': :class:`Commit <github.Commit.Commit>`}
"""
assert isinstance(path, (str, unicode)), \
'path must be str/unicode object'
@@ -1349,6 +1353,9 @@ class Repository(github.GithubObject.CompletableGithubObject):
input=url_parameters
)
return {'commit': github.Commit.Commit(self._requester, headers, data['commit'], completed=True),
'content': github.GithubObject.NotSet}
def get_dir_contents(self, path, ref=github.GithubObject.NotSet):
"""
:calls: `GET /repos/:owner/:repo/contents/:path <http://developer.github.com/v3/repos/contents>`_