Browse Source

More picky sluggable validator

Rafał Pitoń 12 years ago
parent
commit
012aebb726
1 changed files with 2 additions and 2 deletions
  1. 2 2
      misago/validators.py

+ 2 - 2
misago/validators.py

@@ -11,7 +11,7 @@ class validate_sluggable(object):
         self.error_long = error_long if error_long else _("Value is too long.")
 
     def __call__(self, value):
-        slug = slugify(value)
+        slug = slugify(value.replace('_', '').replace('-', ''))
         if not slug:
             raise ValidationError(self.error_short)
         if len(slug) > 255:
@@ -45,7 +45,7 @@ def validate_username(value):
     else:
         if not re.search('^[^\W_]+$', value):
             raise ValidationError(_("Username can only contain latin alphabet letters and digits."))
-    
+
     if Ban.objects.check_ban(username=value):
         raise ValidationError(_("This username is forbidden."))