X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/08948f69c835e27c0f90dea93d71901a5a62b0f5..32509c7ba5495ee0b0e42b0343cbd2a6125532cd:/forum/utils/userlinking.py diff --git a/forum/utils/userlinking.py b/forum/utils/userlinking.py index 53a49dc..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,25 +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)