Code

fixed history to display username instead of userid
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 10 Oct 2002 03:48:16 +0000 (03:48 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 10 Oct 2002 03:48:16 +0000 (03:48 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1331 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/templating.py

index 4c4a13b3656ab9865bd139874e51d0f6cbdeabf5..cfe998e01dd97b4d149e654d29b8e1581bb57b2d 100644 (file)
@@ -490,7 +490,7 @@ class HTMLItem(HTMLPermissions):
         # XXX do this
         return []
 
-    def history(self, direction='descending'):
+    def history(self, direction='descending', dre=re.compile('\d+')):
         l = ['<table class="history">'
              '<tr><th colspan="4" class="header">',
              _('History'),
@@ -629,6 +629,10 @@ class HTMLItem(HTMLPermissions):
                     handled by the history display!</em></strong>''')
                 arg_s = '<strong><em>' + str(args) + '</em></strong>'
             date_s = date_s.replace(' ', '&nbsp;')
+            # if the user's an itemid, figure the username (older journals
+            # have the username)
+            if dre.match(user):
+                user = self._db.user.get(user, 'username')
             l.append('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'%(
                 date_s, user, action, arg_s))
         if comments: