Browse Source

We really want to manipulate bytes objects here

Baptiste Jonglez 10 years ago
parent
commit
59cab26ca0
1 changed files with 2 additions and 1 deletions
  1. 2 1
      coin/members/models.py

+ 2 - 1
coin/members/models.py

@@ -140,7 +140,8 @@ class Member(CoinLdapSyncMixin, AbstractUser):
         username = unicodedata.normalize('NFD', username)\
             .encode('ascii', 'ignore')
         # Enlever ponctuation et espace
-        username = username.translate(None, string.punctuation + ' ')
+        punctuation = (string.punctuation + ' ').encode('ascii')
+        username = username.translate(None, punctuation)
         # En minuscule
         username = username.lower()
         # Maximum de 30 char