]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/registry.py
undoing the changes made in commit #1045, could cause null pointer exceptions
[osqa.git] / forum / registry.py
index 43f11a7ac613e84e4c36a74b122579adfba966f2..e5fb7c6fd4005941471e3d51b6f78a9811530a64 100644 (file)
@@ -1,5 +1,6 @@
 from forum.modules import ui, get_modules_script
 from django.utils.translation import ugettext as _
+from django.utils.encoding import smart_unicode
 from django.core.urlresolvers import reverse
 from django.template.defaultfilters import slugify
 
@@ -29,7 +30,7 @@ ui.register(ui.HEADER_LINKS,
 
             ui.Link(
                     visibility=ui.Visibility.AUTHENTICATED,
-                    text=lambda u, c: u.username,
+                    text=lambda u, c: smart_unicode(u.username),
                     url=lambda u, c: u.get_profile_url(),
                     post_code=lambda u, c: get_score_badge(u),
                     weight=100, name='ACCOUNT'),
@@ -83,7 +84,7 @@ ui.register(ui.USER_MENU,
             ),
             ui.UserMenuItem(
                 label=_("email notification settings"),
-                url=lambda u, c: reverse('user_subscriptions', kwargs={'id': c['user'].id, 'slug': slugify(c['user'].username)}),
+                url=lambda u, c: reverse('user_subscriptions', kwargs={'id': c['user'].id, 'slug': slugify(smart_unicode(c['user'].username))}),
                 span_attrs={'class': 'user-subscriptions'},
                 weight=200,
                 name='EMAIL_SETTINGS'