[PATCH 2 of 2] controllers: add docstring to create_cs_pr_comment and delete_cs_pr_comment

Thomas De Schampheleire patrickdepinguin at gmail.com
Thu Nov 22 20:33:09 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1542917985 -3600
#      Thu Nov 22 21:19:45 2018 +0100
# Node ID 5e37954ebb89d8fbadee1412e71a2d69e98ee63b
# Parent  901a5f2f3530db95e7eda648a10ec47e03333020
controllers: add docstring to create_cs_pr_comment and delete_cs_pr_comment

diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py
+++ b/kallithea/controllers/changeset.py
@@ -167,6 +167,19 @@ def _context_url(GET, fileid=None):
 
 
 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.
+
+    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 as
+    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 +267,7 @@ def create_cs_pr_comment(repo_name, revi
     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()


More information about the kallithea-general mailing list