Merge pull request #289 from andycasey/master

Add optional context when creating a status for a commit
This commit is contained in:
Jimmy Zelinskie
2015-03-03 12:47:15 -05:00
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ What's new?
Version 1.25.2 (October 7th, 2014)
----------------------------------
* `Work around <https://github.com/jacquev6/PyGithub/issues/278>`__ the API v3 returning `null`s in some paginated responses, `erichaase <https://github.com/erichaase>`__ for the bug report
* `Work around <https://github.com/jacquev6/PyGithub/issues/278>`__ the API v3 returning ``null`` in some paginated responses, thanks `erichaase <https://github.com/erichaase>`__ for the bug report
Version 1.25.1 (September 28th, 2014)
-------------------------------------
+5 -1
View File
@@ -150,17 +150,19 @@ class Commit(github.GithubObject.CompletableGithubObject):
)
return github.CommitComment.CommitComment(self._requester, headers, data, completed=True)
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet):
def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet, context=github.GithubObject.NotSet):
"""
:calls: `POST /repos/:owner/:repo/statuses/:sha <http://developer.github.com/v3/repos/statuses>`_
:param state: string
:param target_url: string
:param description: string
:param context: string
:rtype: :class:`github.CommitStatus.CommitStatus`
"""
assert isinstance(state, (str, unicode)), state
assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url
assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description
assert context is github.GithubObject.NotSet or isinstance(context, (str, unicode)), context
post_parameters = {
"state": state,
}
@@ -168,6 +170,8 @@ class Commit(github.GithubObject.CompletableGithubObject):
post_parameters["target_url"] = target_url
if description is not github.GithubObject.NotSet:
post_parameters["description"] = description
if context is not github.GithubObject.NotSet:
post_parameters["context"] = context
headers, data = self._requester.requestJsonAndCheck(
"POST",
self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha,