Browse Source

Ldapdb expects fields to be bytes, not unicode strings (this is probably an upstream bug)

Baptiste Jonglez 10 years ago
parent
commit
b49702d6b8
2 changed files with 26 additions and 26 deletions
  1. 15 15
      coin/members/models.py
  2. 11 11
      coin/vpn/models.py

+ 15 - 15
coin/members/models.py

@@ -274,20 +274,20 @@ class MembershipFee(models.Model):
 
 class LdapUser(ldapdb.models.Model):
     base_dn = settings.LDAP_USER_BASE_DN #"ou=users,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-    object_classes = ['inetOrgPerson', 'organizationalPerson', 'person',
-                      'top', 'posixAccount']
+    object_classes = [b'inetOrgPerson', b'organizationalPerson', b'person',
+                      b'top', b'posixAccount']
 
-    uid = CharField(db_column='uid', unique=True, max_length=255)
-    nick_name = CharField(db_column='cn', unique=True, primary_key=True,
+    uid = CharField(db_column=b'uid', unique=True, max_length=255)
+    nick_name = CharField(db_column=b'cn', unique=True, primary_key=True,
                           max_length=255)
-    first_name = CharField(db_column='givenName', max_length=255)
-    last_name = CharField(db_column='sn', max_length=255)
-    display_name = CharField(db_column='displayName', max_length=255,
+    first_name = CharField(db_column=b'givenName', max_length=255)
+    last_name = CharField(db_column=b'sn', max_length=255)
+    display_name = CharField(db_column=b'displayName', max_length=255,
                              blank=True)
-    password = CharField(db_column='userPassword', max_length=255)
-    uidNumber = IntegerField(db_column='uidNumber', unique=True)
-    gidNumber = IntegerField(db_column='gidNumber', default=2000)
-    homeDirectory = CharField(db_column='homeDirectory', max_length=255,
+    password = CharField(db_column=b'userPassword', max_length=255)
+    uidNumber = IntegerField(db_column=b'uidNumber', unique=True)
+    gidNumber = IntegerField(db_column=b'gidNumber', default=2000)
+    homeDirectory = CharField(db_column=b'homeDirectory', max_length=255,
                               default='/tmp')
 
     def __unicode__(self):
@@ -299,11 +299,11 @@ class LdapUser(ldapdb.models.Model):
 
 class LdapGroup(ldapdb.models.Model):
     base_dn = settings.LDAP_GROUP_BASE_DN #"ou=groups,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-    object_classes = ['posixGroup']
+    object_classes = [b'posixGroup']
 
-    gid = IntegerField(db_column='gidNumber', unique=True)
-    name = CharField(db_column='cn', max_length=200, primary_key=True)
-    members = ListField(db_column='memberUid')
+    gid = IntegerField(db_column=b'gidNumber', unique=True)
+    name = CharField(db_column=b'cn', max_length=200, primary_key=True)
+    members = ListField(db_column=b'memberUid')
 
     def __unicode__(self):
         return self.name

+ 11 - 11
coin/vpn/models.py

@@ -159,17 +159,17 @@ class VPNConfiguration(CoinLdapSyncMixin, Configuration):
 class LdapVPNConfig(ldapdb.models.Model):
     # TODO: déplacer ligne suivante dans settings.py
     base_dn = settings.VPN_CONF_BASE_DN # "ou=vpn,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-    object_classes = ['person', 'organizationalPerson', 'inetOrgPerson',
-                      'top', 'radiusprofile']
-
-    login = CharField(db_column='cn', primary_key=True, max_length=255)
-    sn = CharField(db_column='sn', max_length=255)
-    password = CharField(db_column='userPassword', max_length=255)
-    active = CharField(db_column='dialupAccess', max_length=3)
-    ipv4_endpoint = CharField(db_column='radiusFramedIPAddress', max_length=16)
-    ipv6_endpoint = CharField(db_column='postalAddress', max_length=40)
-    ranges_v4 = ListField(db_column='radiusFramedRoute')
-    ranges_v6 = ListField(db_column='registeredAddress')
+    object_classes = [b'person', b'organizationalPerson', b'inetOrgPerson',
+                      b'top', b'radiusprofile']
+
+    login = CharField(db_column=b'cn', primary_key=True, max_length=255)
+    sn = CharField(db_column=b'sn', max_length=255)
+    password = CharField(db_column=b'userPassword', max_length=255)
+    active = CharField(db_column=b'dialupAccess', max_length=3)
+    ipv4_endpoint = CharField(db_column=b'radiusFramedIPAddress', max_length=16)
+    ipv6_endpoint = CharField(db_column=b'postalAddress', max_length=40)
+    ranges_v4 = ListField(db_column=b'radiusFramedRoute')
+    ranges_v6 = ListField(db_column=b'registeredAddress')
 
     def __unicode__(self):
         return self.login