From 0be51bc4fa4797443591e0b1d230798badc3bd99 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 17 2015 11:52:50 +0000 Subject: Expand the progit.lib.new_issue With this change the new_issue method can now be used to specify - the issue uid - the status of the issue If no issue uid is specified, a new one is generated. If no status is specified, the default one is used. --- diff --git a/progit/lib/__init__.py b/progit/lib/__init__.py index d0a3bb6..400ee66 100644 --- a/progit/lib/__init__.py +++ b/progit/lib/__init__.py @@ -392,7 +392,7 @@ def new_project(session, user, name, gitfolder, docfolder, ticketfolder, def new_issue(session, repo, title, content, user, ticketfolder, - private=False): + issue_uid=None, private=False, status=None): ''' Create a new issue for the specified repo. ''' user_obj = __get_user(session, user) @@ -402,9 +402,13 @@ def new_issue(session, repo, title, content, user, ticketfolder, title=title, content=content, user_id=user_obj.id, - uid=uuid.uuid4().hex, + uid=issue_uid or uuid.uuid4().hex, private=private, ) + + if status is not None: + issue.status = status + session.add(issue) # Make sure we won't have SQLAlchemy error before we create the issue session.flush()