Changeset 2191
- Timestamp:
- 04/01/05 11:27:31 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r2188 r2191 40 40 import ldap 41 41 import ldap.modlist 42 import ldap.cidict 42 43 except ImportError : 43 44 import sys … … 158 159 else : 159 160 self.tool.logdebug("QUERY : Result : %s" % result) 161 result = [ (dn, ldap.cidict.cidict(attrs)) for (dn, attrs) in result ] 160 162 if self.useldapcache : 161 163 for (dn, attributes) in result : … … 167 169 def doAdd(self, dn, fields) : 168 170 """Adds an entry in the LDAP directory.""" 169 fields = self.normalizeFields( fields)171 fields = self.normalizeFields(ldap.cidict.cidict(fields)) 170 172 message = "" 171 173 for tryit in range(3) : … … 213 215 def doModify(self, dn, fields, ignoreold=1, flushcache=0) : 214 216 """Modifies an entry in the LDAP directory.""" 217 fields = ldap.cidict.cidict(fields) 215 218 for tryit in range(3) : 216 219 try : … … 246 249 modentry = [] 247 250 for (mop, mtyp, mval) in entry : 248 if mtyp != "createTimestamp":251 if mtyp and (mtyp.lower() != "createtimestamp") : 249 252 modentry.append((mop, mtyp, mval)) 250 253 self.tool.logdebug("MODIFY : %s ==> %s ==> %s" % (fields, entry, modentry)) … … 278 281 """ 279 282 result = [] 280 for recordin records :281 attrval = record [1].get(attribute, [None])[0]283 for (dn, record) in records : 284 attrval = record.get(attribute, [None])[0] 282 285 if attrval is None : 283 self.tool.printInfo("Object %s has no %s attribute !" % ( record[0], attribute), "error")286 self.tool.printInfo("Object %s has no %s attribute !" % (dn, attribute), "error") 284 287 else : 285 288 result.append(attrval) … … 690 693 message = _("Unable to find an existing objectClass %s entry with %s=%s to attach pykotaAccount objectClass") % (where, self.info["userrdn"], user.Name) 691 694 if action.lower() == "warn" : 692 self.tool.printInfo( "%s. A new entry will be created instead."% message, "warn")695 self.tool.printInfo(_("%s. A new entry will be created instead.") % message, "warn") 693 696 else : # 'fail' or incorrect setting 694 697 raise PyKotaStorageError, "%s. Action aborted. Please check your configuration." % message