X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/97d088726443a6b1c682cf629b5662c54bfbb291..592d1a73d6fcc1aba85b3aa016803939f755a15d:/forum/utils/userlinking.py diff --git a/forum/utils/userlinking.py b/forum/utils/userlinking.py index 39f8bbb..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'@\w+') +APPEAL_PATTERN = re.compile(r'(?%s' % (profile_url, to_replace)