From: jordan Date: Sat, 2 Jul 2011 16:02:41 +0000 (+0000) Subject: OSQA-715, the user linker now supports Unicode usernames, passing the users in the... X-Git-Tag: live~220 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/0ebe3a41f3998814fd2f025b1e255bdc6d019a71 OSQA-715, the user linker now supports Unicode usernames, passing the users in the linker through the smart_unicode filter, changing the regex to UNICODE git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1093 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/utils/userlinking.py b/forum/utils/userlinking.py index 6693883..741a950 100644 --- a/forum/utils/userlinking.py +++ b/forum/utils/userlinking.py @@ -1,9 +1,15 @@ +# -*- coding: utf-8 -*- + import re +from django.utils.encoding import smart_unicode from forum.models.user import User def find_best_match_in_name(content, uname, fullname, start_index): - end_index = start_index + len(fullname) + uname = smart_unicode(uname) + fullname = smart_unicode(fullname) + + end_index = start_index + len(fullname) while end_index > start_index: if content[start_index : end_index].lower() == fullname.lower(): @@ -17,7 +23,7 @@ def find_best_match_in_name(content, uname, fullname, start_index): return uname -APPEAL_PATTERN = re.compile(r'(?%s' % (profile_url, to_replace)