2
0
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:
Jarrod Johnson 2016-05-02 10:44:12 -04:00
parent e949ee932a
commit d5e833480e

View File

@ -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