Commits

Zhang Huangbin committed 2ffbf7e

Code cleanup.

  • Participants
  • Parent commits 4ed3a12

Comments (0)

Files changed (2)

File libs/ldaplib/admin.py

             mod_attrs += [ (ldap.MOD_REPLACE, 'preferredLanguage', self.lang) ]
 
             cn = data.get('cn', None)
-            mod_attrs += ldaputils.getSingleModAttr(attr='cn', value=cn, default=self.mail.split('@')[0])
+            mod_attrs += ldaputils.getSingleModAttr(attr='cn', value=cn, default=self.mail.split('@')[0],)
 
             try:
                 # Modify profiles.

File libs/ldaplib/ldaputils.py

         mod_attrs = [ ( ldap.MOD_REPLACE, attr, value.encode('utf-8') ) ]
     else:
         if default is not None and default != 'None':
-            mod_attrs = [ ( ldap.MOD_REPLACE, attr, default.encode('utf-8') ) ]
+            if encode is True:
+                mod_attrs = [ ( ldap.MOD_REPLACE, attr, default.encode('utf-8') ) ]
+            else:
+                mod_attrs = [ ( ldap.MOD_REPLACE, attr, default) ]
         else:
             mod_attrs = [ ( ldap.MOD_REPLACE, attr, default ) ]