diff rhodecode/lib/helpers.py @ 2731:09d8fec02954 beta

Implemented #532. - now displaying username + full name for mapped users from RhodeCode
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 23 Aug 2012 22:22:46 +0200
parents aa17c7a1b8a5
children 9d8f63ff9219
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Wed Aug 22 13:30:52 2012 +0200
+++ b/rhodecode/lib/helpers.py	Thu Aug 23 22:22:46 2012 +0200
@@ -416,9 +416,9 @@
     return None
 
 
-def person(author):
+def person(author, show_attr="username_and_name"):
     # attr to return from fetched user
-    person_getter = lambda usr: usr.username
+    person_getter = lambda usr: getattr(usr, show_attr)
 
     # Valid email in the attribute passed, see if they're in the system
     _email = email(author)
@@ -439,9 +439,9 @@
     return _author
 
 
-def person_by_id(id_):
+def person_by_id(id_, show_attr="username_and_name"):
     # attr to return from fetched user
-    person_getter = lambda usr: usr.username
+    person_getter = lambda usr: getattr(usr, show_attr)
 
     #maybe it's an ID ?
     if str(id_).isdigit() or isinstance(id_, int):