diff --git a/github2/pull_requests.py b/github2/pull_requests.py index fe8ef1b..09f92e5 100644 --- a/github2/pull_requests.py +++ b/github2/pull_requests.py @@ -53,7 +53,7 @@ def create(self, project, base, head, title=None, body=None, issue=None): issue. If an ``issue`` parameter is supplied the pull request is attached to that issue, else a new pull request is created. - :param str project: Github project + :param str project: the Github project to send the pull request to :param str base: branch changes should be pulled into :param str head: branch of the changes to be pulled :param str title: title for pull request @@ -67,6 +67,10 @@ def create(self, project, base, head, title=None, body=None, issue=None): post_data["title"] = title if body: post_data["body"] = body + else: + raise TypeError("You must either specify a title for the " + "pull request or an issue number to which the " + "pull request should be attached.") pull_request_data = [("pull[%s]" % k, v) for k, v in post_data.items()] return self.get_value(project, post_data=dict(pull_request_data), filter="pull", datatype=PullRequest)