[PATCH 16 of 19] user: show 'Firstname Lastname (username)'

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jun 30 16:43:26 EDT 2015


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1435695184 -7200
#      Tue Jun 30 22:13:04 2015 +0200
# Node ID c30928f2b0243029ebc3d14063da33a6f1d1313f
# Parent  5ba77a9c9e3b7a309adb6a2d2b0e6aab1b303b75
user: show 'Firstname Lastname (username)'

Additionally, clarify both full_name_or_username and full_name_and_username
with docstrings.

diff --git a/kallithea/model/db.py b/kallithea/model/db.py
--- a/kallithea/model/db.py
+++ b/kallithea/model/db.py
@@ -477,12 +477,19 @@ class User(Base, BaseModel):
 
     @property
     def full_name_or_username(self):
+        """
+        Show full name.
+        If full name is not set, fall back to username.
+        """
         return ('%s %s' % (self.firstname, self.lastname)
                 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)
+        """
+        Show full name and username as 'Firstname Lastname (username)'.
+        """
+        return '%s %s (%s)' % (self.firstname, self.lastname, self.username)
 
     @property
     def full_contact(self):


More information about the kallithea-general mailing list