Changeset 2221 for pykota/trunk
- Timestamp:
- 04/28/05 23:36:22 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r2218 r2221 29 29 # 30 30 31 import sys 31 32 import os 32 33 import types … … 40 41 import ldap 41 42 import ldap.modlist 42 import ldap.cidict43 43 except ImportError : 44 import sys45 44 raise PyKotaStorageError, "This python version (%s) doesn't seem to have the python-ldap module installed correctly." % sys.version.split()[0] 45 else : 46 try : 47 from ldap.cidict import cidict 48 except ImportError : 49 import UserDict 50 sys.stderr.write("ERROR: PyKota requires a newer version of python-ldap. Workaround activated. Please upgrade python-ldap !\n") 51 class cidict(UserDict.UserDict) : 52 pass # Fake it all, and don't care for case insensitivity : users who need it will have to upgrade. 46 53 47 54 class Storage(BaseStorage) : … … 159 166 else : 160 167 self.tool.logdebug("QUERY : Result : %s" % result) 161 result = [ (dn, ldap.cidict.cidict(attrs)) for (dn, attrs) in result ]168 result = [ (dn, cidict(attrs)) for (dn, attrs) in result ] 162 169 if self.useldapcache : 163 170 for (dn, attributes) in result : … … 169 176 def doAdd(self, dn, fields) : 170 177 """Adds an entry in the LDAP directory.""" 171 fields = self.normalizeFields( ldap.cidict.cidict(fields))178 fields = self.normalizeFields(cidict(fields)) 172 179 message = "" 173 180 for tryit in range(3) : … … 215 222 def doModify(self, dn, fields, ignoreold=1, flushcache=0) : 216 223 """Modifies an entry in the LDAP directory.""" 217 fields = ldap.cidict.cidict(fields)224 fields = cidict(fields) 218 225 for tryit in range(3) : 219 226 try :