]> git.openstreetmap.org Git - osqa.git/commitdiff
Changing the way we get the User subscribed URL address, before we used the @models...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 14 Apr 2011 20:43:44 +0000 (20:43 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 14 Apr 2011 20:43:44 +0000 (20:43 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@984 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/user.py

index afb33d34b03cc579d5473cfa874ecdcf76aa9964..b5bef173c3e2e0a1d5ff39c2e442e0729ab7ba7f 100644 (file)
@@ -211,9 +211,15 @@ class User(BaseModel, DjangoUser):
     def get_answered_url(self):
         return ('user_questions', (), {'mode': _('answered-by'), 'user': self.id, 'slug': slugify(self.username)})
 
-    @models.permalink
     def get_subscribed_url(self):
-        return ('user_questions', (), {'mode': _('subscribed-by'), 'user': self.id, 'slug': slugify(self.username)})
+        try:
+            # Try to retrieve the Subscribed User URL.
+            url = reverse('user_questions',
+                           kwargs={'mode': _('subscribed-by'), 'user': self.id, 'slug': slugify(smart_unicode(self.username))})
+            return url
+        except Exception, e:
+            # If some Exception has been raised, don't forget to log it.
+            logging.error("Error retrieving a subscribed user URL: %s" % e)
 
     def get_profile_link(self):
         profile_link = u'<a href="%s">%s</a>' % (self.get_profile_url(), self.username)