# HG changeset patch
# User Jan Heylen <heyl...@gmail.com>
# Date 1430766457 -7200
#      Mon May 04 21:07:37 2015 +0200
# Node ID 4fad09a8ca22ff3ec15ceb46383e0d534682e048
# Parent  7a5db341a942a4bea1c433846ad040e8ae0d8a68
changeset/pullrequest controller: refactor some old variable naming

c.co is a bit cryptic, use the full name c.comment
comm sounds like 'communication', use the full name, comment

tested by adding a single comment on a changeset/pullreques
and running:
* the kallithea/tests/functional/test_changeset_comments.py test

diff -r 7a5db341a942 -r 4fad09a8ca22 kallithea/controllers/changeset.py
--- a/kallithea/controllers/changeset.py        Tue May 12 23:32:41 2015 +0200
+++ b/kallithea/controllers/changeset.py        Mon May 04 21:07:37 2015 +0200
@@ -351,7 +351,7 @@
         status = request.POST.get('changeset_status')
         text = request.POST.get('text', '').strip()
 
-        c.co = comm = ChangesetCommentsModel().create(
+        c.comment = comment = ChangesetCommentsModel().create(
             text=text,
             repo=c.db_repo.repo_id,
             user=c.authuser.user_id,
@@ -373,7 +373,7 @@
                     c.db_repo.repo_id,
                     status,
                     c.authuser.user_id,
-                    comm,
+                    comment,
                     revision=revision,
                     dont_allow_on_closed_pull_request=True
                 )
@@ -397,8 +397,8 @@
         data = {
            'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
         }
-        if comm:
-            data.update(comm.get_dict())
+        if comment:
+            data.update(comment.get_dict())
             data.update({'rendered_text':
                          render('changeset/changeset_comment_block.html')})
 
diff -r 7a5db341a942 -r 4fad09a8ca22 kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py     Tue May 12 23:32:41 2015 +0200
+++ b/kallithea/controllers/pullrequests.py     Mon May 04 21:07:37 2015 +0200
@@ -700,7 +700,7 @@
         if close_pr:
             text = _('Closing.') + '\n' + text
 
-        comm = ChangesetCommentsModel().create(
+        comment = ChangesetCommentsModel().create(
             text=text,
             repo=c.db_repo.repo_id,
             user=c.authuser.user_id,
@@ -723,7 +723,7 @@
                     c.db_repo.repo_id,
                     status,
                     c.authuser.user_id,
-                    comm,
+                    comment,
                     pull_request=pull_request_id
                 )
 
@@ -741,9 +741,9 @@
         data = {
            'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
         }
-        if comm:
-            c.co = comm
-            data.update(comm.get_dict())
+        if comment:
+            c.comment = comment
+            data.update(comment.get_dict())
             data.update({'rendered_text':
                          render('changeset/changeset_comment_block.html')})
 
diff -r 7a5db341a942 -r 4fad09a8ca22 
kallithea/templates/changeset/changeset_comment_block.html
--- a/kallithea/templates/changeset/changeset_comment_block.html        Tue May 
12 23:32:41 2015 +0200
+++ b/kallithea/templates/changeset/changeset_comment_block.html        Mon May 
04 21:07:37 2015 +0200
@@ -1,4 +1,4 @@
 ## this is a dummy html file for partial rendering on server and sending
 ## generated output via ajax after comment submit
 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
-${comment.comment_block(c.co)}
+${comment.comment_block(c.comment)}
_______________________________________________
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general

Reply via email to