From 359db930e63cd7eabc2542159c096ac9e8e9a963 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 26 2014 08:20:55 +0000 Subject: Add method to the internal API: add_issue_comment to add a comment on a issue Signed-off-by: Pierre-Yves Chibon --- diff --git a/progit/lib.py b/progit/lib.py index 7d1fec4..669849c 100644 --- a/progit/lib.py +++ b/progit/lib.py @@ -42,6 +42,20 @@ def create_session(db_url, debug=False, pool_recycle=3600): return scopedsession +def add_issue_comment(session, issue, comment, user): + ''' Add a comment to an issue. ''' + isse_comment = model.IssueComment( + issue_id=issue.id, + comment=comment, + user=user, + ) + session.add(isse_comment) + # Make sure we won't have SQLAlchemy error before we create the repo + session.flush() + + return 'Comment added' + + def get_user_project(session, username): ''' Retrieve the list of projects managed by a user.