Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support clearing of issue milestone and assignee #74

Closed
wants to merge 2 commits into from

2 participants

@quixotique

I could find no way to use the PyGithub API to clear an Issue's milestone or assignee. So I created this patch to make Issue.edit() accept None for the milestone and assignee parameters. I have tested it on a real GitHub issue, and it works, but I have not created any test cases.

@jacquev6 jacquev6 was assigned
@jacquev6
Owner

Thank you for your contribution! I will merge it this week.

Note to myself: create the test cases, update ReferenceOfClasses.md.

@jacquev6
Owner

Merged in branch develop, will be in version 1.7 tonight or tomorrow.

Thank you again for your contribution.

@jacquev6 jacquev6 closed this
@quixotique

That's beautiful, and thanks for PyGithub, it works a treat!

@quixotique quixotique added the v1 label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 github/Issue.py
View
8 github/Issue.py
@@ -150,9 +150,9 @@ def delete_labels( self ):
def edit( self, title = GithubObject.NotSet, body = GithubObject.NotSet, assignee = GithubObject.NotSet, state = GithubObject.NotSet, milestone = GithubObject.NotSet, labels = GithubObject.NotSet ):
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
assert body is GithubObject.NotSet or isinstance( body, ( str, unicode ) ), body
- assert assignee is GithubObject.NotSet or isinstance( assignee, NamedUser.NamedUser ), assignee
+ assert assignee is GithubObject.NotSet or assignee is None or isinstance( assignee, NamedUser.NamedUser ), assignee
assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state
- assert milestone is GithubObject.NotSet or isinstance( milestone, Milestone.Milestone ), milestone
+ assert milestone is GithubObject.NotSet or milestone is None or isinstance( milestone, Milestone.Milestone ), milestone
assert labels is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in labels ), labels
post_parameters = dict()
if title is not GithubObject.NotSet:
@@ -160,11 +160,11 @@ def edit( self, title = GithubObject.NotSet, body = GithubObject.NotSet, assigne
if body is not GithubObject.NotSet:
post_parameters[ "body" ] = body
if assignee is not GithubObject.NotSet:
- post_parameters[ "assignee" ] = assignee._identity
+ post_parameters[ "assignee" ] = assignee._identity if assignee else ''
if state is not GithubObject.NotSet:
post_parameters[ "state" ] = state
if milestone is not GithubObject.NotSet:
- post_parameters[ "milestone" ] = milestone._identity
+ post_parameters[ "milestone" ] = milestone._identity if milestone else ''
if labels is not GithubObject.NotSet:
post_parameters[ "labels" ] = labels
headers, data = self._requester.requestAndCheck(
Something went wrong with that request. Please try again.