]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/user.py
Make RequestHolder thread-safe
[osqa.git] / forum / models / user.py
index 7f15d21dc38db441befcb9c6a5c554eaddd06cd5..cf47c6653e78b2eaae6f68b5e8ae5039b5c5b8a4 100644 (file)
@@ -117,7 +117,7 @@ class UserManager(CachedManager):
             
             if len(matching_users) == 1:
                 return matching_users[0]
-            else:
+            elif len(matching_users) > 1:
                 for user in matching_users:
                     if user.username == kwargs['username']:
                         return user
@@ -165,8 +165,8 @@ class User(BaseModel, DjangoUser):
         #todo: temporary thing, for now lets just assume that the site owner will always be the first user of the application
         return self.id == 1
 
-    @property
-    def decorated_name(self):
+
+    def _decorated_name(self):
         username = smart_unicode(self.username)
 
         if len(username) > TRUNCATE_USERNAMES_LONGER_THAN and TRUNCATE_LONG_USERNAMES:
@@ -181,6 +181,10 @@ class User(BaseModel, DjangoUser):
 
         return username
 
+    @property
+    def decorated_name(self):
+        return self._decorated_name()
+
     @property
     def last_activity(self):
         try: