From 0ebe3a41f3998814fd2f025b1e255bdc6d019a71 Mon Sep 17 00:00:00 2001 From: jordan Date: Sat, 2 Jul 2011 16:02:41 +0000 Subject: [PATCH] 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 --- forum/utils/userlinking.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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) -- 2.45.1