diff --git a/pykolab/auth/ldap/syncrepl.py b/pykolab/auth/ldap/syncrepl.py --- a/pykolab/auth/ldap/syncrepl.py +++ b/pykolab/auth/ldap/syncrepl.py @@ -2,7 +2,7 @@ try: import anydbm -except: +except ImportError: import dbm.ndbm as anydbm import ldap import ldap.syncrepl @@ -11,11 +11,13 @@ import pykolab from pykolab import utils +from pykolab.translate import _ log = pykolab.getLogger('pykolab.syncrepl') conf = pykolab.getConf() -class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): + +class DNSync(ldap.ldapobject.LDAPObject, ldap.syncrepl.SyncreplConsumer): callback = None @@ -28,7 +30,7 @@ self.__db = anydbm.open(filename, 'c', 0o640) self.__presentUUIDs = {} - def syncrepl_set_cookie(self,cookie): + def syncrepl_set_cookie(self, cookie): self.__db['cookie'] = cookie def syncrepl_get_cookie(self): @@ -36,12 +38,12 @@ return self.__db['cookie'] def syncrepl_delete(self, uuids): - log.debug("syncrepl_delete uuids: %r" % (uuids), level=8) + log.debug("syncrepl_delete uuids: %r" % uuids, level=8) # Get the unique_attribute name to issue along with our # callback (if any) unique_attr = conf.get('ldap', 'unique_attribute') - if unique_attr == None: + if unique_attr is None: unique_attr = 'entryuuid' if unique_attr == 'nsuniqueid': @@ -50,14 +52,13 @@ "is very probably not compatible with the use of " + \ "syncrepl.") ) - for uuid in uuids: dn = self.__db[uuid] - log.debug("syncrepl_delete dn: %r" % (dn), level=8) + log.debug("syncrepl_delete dn: %r" % dn, level=8) - if not self.callback == None: + if self.callback is not None: self.callback( change_type='delete', previous_dn=None, @@ -90,7 +91,7 @@ if uuid in self.__db: odn = self.__db[uuid] if odn != dn: - if not self.callback == None: + if self.callback is not None: self.callback( change_type='moddn', previous_dn=odn, @@ -100,7 +101,7 @@ ) else: - if not self.callback == None: + if self.callback is not None: self.callback( change_type='modify', previous_dn=None, @@ -110,7 +111,7 @@ ) else: - if not self.callback == None: + if self.callback is not None: self.callback( change_type='add', previous_dn=None,