]> git.openstreetmap.org Git - osqa.git/commitdiff
Closing OSQA 112, Support accented characters in screen names.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 17 May 2010 14:30:21 +0000 (14:30 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 17 May 2010 14:30:21 +0000 (14:30 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@292 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/forms.py
forum/utils/forms.py

index 6e736b9a7c9512069770d2f7af3ca307df7e70ad..245372a68a84b174470a67bbb94f65a098cd1365 100644 (file)
@@ -71,7 +71,7 @@ class TagNamesField(forms.CharField):
             if len(tag) > settings.FORM_MAX_LENGTH_OF_TAG or len(tag) < settings.FORM_MIN_LENGTH_OF_TAG:
                 raise forms.ValidationError(_('please use between %(min)s and %(max)s characters in you tags') % { 'min': settings.FORM_MIN_LENGTH_OF_TAG, 'max': settings.FORM_MAX_LENGTH_OF_TAG})
             if not tagname_re.match(tag):
-                raise forms.ValidationError(_('please use following characters in tags: letters \'a-z\', numbers, and characters \'.-_#\''))
+                raise forms.ValidationError(_('please use following characters in tags: letters , numbers, and the following characters \'.-_#\''))
             # only keep one same tag
             if tag not in list_temp and len(tag.strip()) > 0:
                 list_temp.append(tag)
index d91e59f6fe18771019e38c5ebd5907701233c866..1becdf0edd52c648520c32394380bb3ff50dfd47 100644 (file)
@@ -34,7 +34,7 @@ class NextUrlField(forms.CharField):
         return clean_next(value)
 
 login_form_widget_attrs = { 'class': 'required login' }
-username_re = re.compile(r'^[\w ]+$')
+username_re = re.compile(r'^[\w\s ]+$', re.UNICODE)
 
 class UserNameField(StrippedNonEmptyCharField):
     def __init__(self,db_model=User, db_field='username', must_exist=False,skip_clean=False,label=_('choose a username'),**kw):
@@ -73,7 +73,7 @@ class UserNameField(StrippedNonEmptyCharField):
             raise forms.ValidationError(self.error_messages['required'])
         if len(username) < settings.MIN_USERNAME_LENGTH:
             raise forms.ValidationError(self.error_messages['toshort'])
-        if self.required and not username_re.search(username):
+        if self.required and not username_re.match(username):
             raise forms.ValidationError(self.error_messages['invalid'])
         if username in settings.RESERVED_USERNAMES:
             raise forms.ValidationError(self.error_messages['forbidden'])