diff options
| author | 2012-04-19 09:57:34 -0500 | |
|---|---|---|
| committer | 2012-04-19 09:57:34 -0500 | |
| commit | 9008296715194c150e7eeb16469005d771f7d370 (patch) | |
| tree | 62fe10a0a0dd6f5738de0cd7f47ac3c7b670dbc1 /pygithub3/services | |
| parent | merge request won't json encode body without schema (diff) | |
| download | python-github3-9008296715194c150e7eeb16469005d771f7d370.tar.xz python-github3-9008296715194c150e7eeb16469005d771f7d370.zip | |
use _bool for pull request merge status
Diffstat (limited to 'pygithub3/services')
| -rw-r--r-- | pygithub3/services/pull_requests/__init__.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/pygithub3/services/pull_requests/__init__.py b/pygithub3/services/pull_requests/__init__.py index f7da50a..66d9e58 100644 --- a/pygithub3/services/pull_requests/__init__.py +++ b/pygithub3/services/pull_requests/__init__.py @@ -95,23 +95,10 @@ class PullRequests(Service, MimeTypeMixin): :param str repo: Repository """ - # for this to work with a proper Resource, we would need to pass the - # response's status code to the Resource constructor, and that's kind - # of scary - try: - resp = self._client.get( - self.make_request('pull_requests.merge_status', number=number, - user=user, repo=repo) - ) - except NotFound: - return False - code = resp.status_code - if code == 204: - return True - # TODO: more flexible way to return arbitrary objects based on - # response. Probably something on Request - raise BadRequest('got code %s: %s' % (code, resp.content)) - # again, I'm sorry. + return self._bool( + self.make_request('pull_requests.merge_status', number=number, + user=user, repo=repo) + ) def merge(self, number, message='', user=None, repo=None): """Merge a pull request. |
