[PATCH 1 of 4] user: rename property username_and_name into full_name_and_username

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jun 23 15:59:57 EDT 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1435083793 -7200
#      Tue Jun 23 20:23:13 2015 +0200
# Node ID 0bd7300d815257423acca7984472d207676008cb
# Parent  7303d0035d82a20f93df1c78b3358403b7ff9827
user: rename property username_and_name into full_name_and_username

In analogy of existing properties full_name and full_name_or_username,
rename username_and_name into full_name_and_username.

diff --git a/kallithea/model/comment.py b/kallithea/model/comment.py
--- a/kallithea/model/comment.py
+++ b/kallithea/model/comment.py
@@ -100,7 +100,7 @@ class ChangesetCommentsModel(BaseModel):
             recipients += [cs_author]
             email_kwargs = {
                 'status_change': status_change,
-                'cs_comment_user': h.person(user, 'username_and_name'),
+                'cs_comment_user': h.person(user, 'full_name_and_username'),
                 'cs_target_repo': h.canonical_url('summary_home', repo_name=repo.repo_name),
                 'cs_comment_url': comment_url,
                 'raw_id': revision,
@@ -148,7 +148,7 @@ class ChangesetCommentsModel(BaseModel):
                 'status_change': status_change,
                 'closing_pr': closing_pr,
                 'pr_comment_url': comment_url,
-                'pr_comment_user': h.person(user, 'username_and_name'),
+                'pr_comment_user': h.person(user, 'full_name_and_username'),
                 'pr_target_repo': h.canonical_url('summary_home',
                                    repo_name=pull_request.other_repo.repo_name),
                 'repo_name': pull_request.other_repo.repo_name,
diff --git a/kallithea/model/db.py b/kallithea/model/db.py
--- a/kallithea/model/db.py
+++ b/kallithea/model/db.py
@@ -472,10 +472,6 @@ class User(Base, BaseModel):
         return [x.ip_addr for x in ret]
 
     @property
-    def username_and_name(self):
-        return '%s (%s %s)' % (self.username, self.firstname, self.lastname)
-
-    @property
     def full_name(self):
         return '%s %s' % (self.firstname, self.lastname)
 
@@ -485,6 +481,10 @@ class User(Base, BaseModel):
                 if (self.firstname and self.lastname) else self.username)
 
     @property
+    def full_name_and_username(self):
+        return '%s (%s %s)' % (self.username, self.firstname, self.lastname)
+
+    @property
     def full_contact(self):
         return '%s %s <%s>' % (self.firstname, self.lastname, self.email)
 
diff --git a/kallithea/templates/changeset/changeset.html b/kallithea/templates/changeset/changeset.html
--- a/kallithea/templates/changeset/changeset.html
+++ b/kallithea/templates/changeset/changeset.html
@@ -114,7 +114,7 @@
                          <div class="gravatar">
                            ${h.gravatar(h.email_or_none(c.changeset.author), size=20)}
                          </div>
-                         <span><b>${h.person(c.changeset.author,'username_and_name')}</b> - ${h.age(c.changeset.date,True)} ${h.fmt_date(c.changeset.date)}</span><br/>
+                         <span><b>${h.person(c.changeset.author,'full_name_and_username')}</b> - ${h.age(c.changeset.date,True)} ${h.fmt_date(c.changeset.date)}</span><br/>
                          <span>${h.email_or_none(c.changeset.author)}</span><br/>
                      </div>
                      <% rev = c.changeset.extra.get('source') %>
diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html
--- a/kallithea/templates/changeset/changeset_file_comment.html
+++ b/kallithea/templates/changeset/changeset_file_comment.html
@@ -12,7 +12,7 @@
                ${h.gravatar(co.author.email, size=20)}
           </div>
           <div class="user">
-              ${co.author.username_and_name}
+              ${co.author.full_name_and_username}
           </div>
 
           <span>
diff --git a/kallithea/templates/pullrequests/pullrequest_data.html b/kallithea/templates/pullrequests/pullrequest_data.html
--- a/kallithea/templates/pullrequests/pullrequest_data.html
+++ b/kallithea/templates/pullrequests/pullrequest_data.html
@@ -58,7 +58,7 @@
         </a>
       </td>
       <td>
-        ${pr.author.username_and_name}
+        ${pr.author.full_name_and_username}
       </td>
       <td>
         <span class="tooltip" title="${h.tooltip(h.fmt_date(pr.created_on))}">
diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html
+++ b/kallithea/templates/pullrequests/pullrequest_show.html
@@ -158,7 +158,7 @@
                   <div class="gravatar">
                     ${h.gravatar(c.pull_request.author.email, size=20)}
                   </div>
-                  <span>${c.pull_request.author.username_and_name}</span><br/>
+                  <span>${c.pull_request.author.full_name_and_username}</span><br/>
                   <span><a href="mailto:${c.pull_request.author.email}">${c.pull_request.author.email}</a></span><br/>
               </div>
           </div>


More information about the kallithea-general mailing list