X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/7f4982393567a5f6827c12a089363d91338f9f13..48da83177329ce1b7d3dfcfc83600e067120c7e2:/forum/utils/userlinking.py?ds=sidebyside 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)