From ba9a60ad5002f1d8ea271f030f4ae5f5e898f7c7 Mon Sep 17 00:00:00 2001 From: jordan Date: Thu, 14 Apr 2011 21:51:36 +0000 Subject: [PATCH 1/1] notifications improvement, now we make sure that the username has passed through the smart_unicode function and the returned object is a safe unicode string. This used to cause some trouble with the new comment posted notifications. Also fixing a small bug in the accepted answer notifications. The Question object shouldn't go through the smart_str function, then the Question object gets converted to a Unicode string and this caused trouble with the URL reverse process. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@985 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/skins/default/templates/notifications/answeraccepted.html | 2 +- forum/views/users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/forum/skins/default/templates/notifications/answeraccepted.html b/forum/skins/default/templates/notifications/answeraccepted.html index 4ce25a7..5157bd0 100644 --- a/forum/skins/default/templates/notifications/answeraccepted.html +++ b/forum/skins/default/templates/notifications/answeraccepted.html @@ -3,7 +3,7 @@ {% declare %} prefix = html.mark_safe(smart_str(settings.EMAIL_SUBJECT_PREFIX)) answer_author = html.mark_safe(smart_str(answer.author.username)) - question = smart_str(answer.question) + question = answer.question question_title = html.mark_safe(smart_str(question.title)) accepted_by = html.mark_safe(smart_str(answer.nstate.accepted.by.username)) accepted_by_link = html.objlink(answer.nstate.accepted.by, style=settings.EMAIL_ANCHOR_STYLE) diff --git a/forum/views/users.py b/forum/views/users.py index 8766851..d532baf 100644 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -286,7 +286,7 @@ def user_view(template, tab_name, tab_title, tab_description, private=False, tab if tabbed: def url_getter(vu): try: - return reverse(fn.__name__, kwargs={'id': vu.id, 'slug': slugify(vu.username)}) + return reverse(fn.__name__, kwargs={'id': vu.id, 'slug': slugify(smart_unicode(vu.username))}) except NoReverseMatch: return reverse(fn.__name__, kwargs={'id': vu.id}) -- 2.39.5