X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/13bee2f2e6aea2d936909861f3ab60bb09821a60..32509c7ba5495ee0b0e42b0343cbd2a6125532cd:/forum/utils/userlinking.py diff --git a/forum/utils/userlinking.py b/forum/utils/userlinking.py index da476ee..741a950 100644 --- a/forum/utils/userlinking.py +++ b/forum/utils/userlinking.py @@ -1,9 +1,15 @@ +# -*- coding: utf-8 -*- + import re -from forum.models import User, Question, Answer, Comment +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,23 +23,11 @@ def find_best_match_in_name(content, uname, fullname, start_index): return uname -APPEAL_PATTERN = re.compile(r'(?%s' % (profile_url, to_replace)