From 9008296715194c150e7eeb16469005d771f7d370 Mon Sep 17 00:00:00 2001 From: Nat Williams Date: Thu, 19 Apr 2012 09:57:34 -0500 Subject: use _bool for pull request merge status --- pygithub3/services/pull_requests/__init__.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'pygithub3/services') 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. -- cgit v1.2.3-59-g8ed1b