mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-12 10:49:17 +00:00
Tolerate gdbm
gdbm backend does not support the 'iterkeys' interface directly, requiring instead to manually traverse. Unfortunately, dbhash does not implement the gdbm interface for this, so we have to have two codepaths.
This commit is contained in:
parent
e949ee932a
commit
d5e833480e
@ -214,8 +214,14 @@ def _load_dict_from_dbm(dpath, tdb):
|
||||
if elem not in currdict:
|
||||
currdict[elem] = {}
|
||||
currdict = currdict[elem]
|
||||
for tk in dbe.iterkeys():
|
||||
currdict[tk] = cPickle.loads(dbe[tk])
|
||||
try:
|
||||
for tk in dbe.iterkeys():
|
||||
currdict[tk] = cPickle.loads(dbe[tk])
|
||||
except AttributeError:
|
||||
tk = dbe.firstkey()
|
||||
while tk != None:
|
||||
currdict[tk] = cPickle.loads(dbe[tk])
|
||||
tk = dbe.nextkey(tk)
|
||||
except dbm.error:
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user