Changeset View
Changeset View
Standalone View
Standalone View
pykolab/auth/ldap/syncrepl.py
Show All 11 Lines | |||||
log = pykolab.getLogger('pykolab.syncrepl') | log = pykolab.getLogger('pykolab.syncrepl') | ||||
conf = pykolab.getConf() | conf = pykolab.getConf() | ||||
class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): | class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): | ||||
callback = None | callback = None | ||||
def __init__(self, filename, *args, **kwargs): | def __init__(self, filename, *args, **kwargs): | ||||
if kwargs.has_key('callback'): | if 'callback' in kwargs: | ||||
self.callback = kwargs['callback'] | self.callback = kwargs['callback'] | ||||
del kwargs['callback'] | del kwargs['callback'] | ||||
ldap.ldapobject.LDAPObject.__init__(self, *args, **kwargs) | ldap.ldapobject.LDAPObject.__init__(self, *args, **kwargs) | ||||
self.__db = anydbm.open(filename, 'c', 0640) | self.__db = anydbm.open(filename, 'c', 0o640) | ||||
self.__presentUUIDs = {} | self.__presentUUIDs = {} | ||||
def syncrepl_set_cookie(self,cookie): | def syncrepl_set_cookie(self,cookie): | ||||
self.__db['cookie'] = cookie | self.__db['cookie'] = cookie | ||||
def syncrepl_get_cookie(self): | def syncrepl_get_cookie(self): | ||||
if 'cookie' in self.__db: | if 'cookie' in self.__db: | ||||
return self.__db['cookie'] | return self.__db['cookie'] | ||||
Show All 32 Lines | def syncrepl_delete(self, uuids): | ||||
) | ) | ||||
del self.__db[uuid] | del self.__db[uuid] | ||||
def syncrepl_present(self, uuids, refreshDeletes=False): | def syncrepl_present(self, uuids, refreshDeletes=False): | ||||
if uuids is None: | if uuids is None: | ||||
if refreshDeletes is False: | if refreshDeletes is False: | ||||
nonpresent = [] | nonpresent = [] | ||||
for uuid in self.__db.keys(): | for uuid in self.__db: | ||||
if uuid == 'cookie': continue | if uuid == 'cookie': continue | ||||
Lint: PEP8 E701: multiple statements on one line (colon) | |||||
if uuid in self.__presentUUIDs: continue | if uuid in self.__presentUUIDs: continue | ||||
Lint: PEP8 E701 multiple statements on one line (colon) Lint: PEP8 E701: multiple statements on one line (colon) | |||||
nonpresent.append(uuid) | nonpresent.append(uuid) | ||||
self.syncrepl_delete(nonpresent) | self.syncrepl_delete(nonpresent) | ||||
self.__presentUUIDs = {} | self.__presentUUIDs = {} | ||||
else: | else: | ||||
for uuid in uuids: | for uuid in uuids: | ||||
self.__presentUUIDs[uuid] = True | self.__presentUUIDs[uuid] = True | ||||
def syncrepl_entry(self, dn, attrs, uuid): | def syncrepl_entry(self, dn, attrs, uuid): | ||||
Show All 35 Lines |
multiple statements on one line (colon)