changeset 7435:2c54a82aeaed

controllers: add docstring to create_cs_pr_comment and delete_cs_pr_comment
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Thu, 22 Nov 2018 21:19:45 +0100
parents 901a5f2f3530
children 8ed615e77e50
files kallithea/controllers/changeset.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py	Thu Nov 22 21:01:54 2018 +0100
+++ b/kallithea/controllers/changeset.py	Thu Nov 22 21:19:45 2018 +0100
@@ -167,6 +167,20 @@
 
 
 def create_cs_pr_comment(repo_name, revision=None, pull_request=None, allowed_to_change_status=True):
+    """
+    Add a comment to the specified changeset or pull request, using POST values
+    from the request.
+
+    Comments can be inline (when a file path and line number is specified in
+    POST) or general comments.
+    A comment can be accompanied by a review status change (accepted, rejected,
+    etc.). Pull requests can be closed or deleted.
+
+    Parameter 'allowed_to_change_status' is used for both status changes and
+    closing of pull requests. For deleting of pull requests, more specific
+    checks are done.
+    """
+
     assert request.environ.get('HTTP_X_PARTIAL_XHR')
     if pull_request:
         pull_request_id = pull_request.pull_request_id
@@ -254,6 +268,7 @@
     return data
 
 def delete_cs_pr_comment(repo_name, comment_id):
+    """Delete a comment from a changeset or pull request"""
     co = ChangesetComment.get_or_404(comment_id)
     if co.repo.repo_name != repo_name:
         raise HTTPNotFound()