[PATCH 08 of 14] controllers: pullrequests: rename _get_is_allowed_change_status

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Nov 20 20:32:19 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1541881769 -3600
#      Sat Nov 10 21:29:29 2018 +0100
# Node ID 909dc1223bf73fa46beec48fd5bfccb14a9fd17d
# Parent  cfdb93ba1005f12171504bdbfd7df2562329c397
controllers: pullrequests: rename _get_is_allowed_change_status

Rename the oddly named method '_get_is_allowed_change_status' to
'_is_allowed_to_change_status'. Not only does this read more easily, but
also it is more in line with the variable to which the result is assigned to
'allowed_to_change_status'.

diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py
+++ b/kallithea/controllers/pullrequests.py
@@ -186,7 +186,7 @@ class PullrequestsController(BaseRepoCon
                   ]
         return [g for g in groups if g[0]], selected
 
-    def _get_is_allowed_change_status(self, pull_request):
+    def _is_allowed_to_change_status(self, pull_request):
         if pull_request.is_closed():
             return False
 
@@ -453,7 +453,7 @@ class PullrequestsController(BaseRepoCon
         repo_model = RepoModel()
         c.users_array = repo_model.get_users_js()
         c.pull_request = PullRequest.get_or_404(pull_request_id)
-        c.allowed_to_change_status = self._get_is_allowed_change_status(c.pull_request)
+        c.allowed_to_change_status = self._is_allowed_to_change_status(c.pull_request)
         cc_model = ChangesetCommentsModel()
         cs_model = ChangesetStatusModel()
 
@@ -644,7 +644,7 @@ class PullrequestsController(BaseRepoCon
             # status votes and closing is only possible in general comments
             raise HTTPBadRequest()
 
-        allowed_to_change_status = self._get_is_allowed_change_status(pull_request)
+        allowed_to_change_status = self._is_allowed_to_change_status(pull_request)
         if not allowed_to_change_status:
             if status or close_pr:
                 h.flash(_('No permission to change pull request status'), 'error')


More information about the kallithea-general mailing list