Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a4409c

Browse files
author
Moshe Zadka
committed
Added support to recognize Python's internal "dumbdbm" database.
This closes bug 200 on Jitterbug.
1 parent 37c03ff commit 7a4409c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/whichdb.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ def whichdb(filename):
2525
except IOError:
2626
pass
2727

28+
# Check for dumbdbm next -- this has a .dir and and a .dat file
29+
f = open(filename + ".dat", "rb")
30+
f.close()
31+
f = open(filename + ".dir", "rb")
32+
try:
33+
if f.read(1) in ["'", '"']:
34+
return "dumbdbm"
35+
finally:
36+
f.close()
37+
except IOError:
38+
pass
39+
2840
# See if the file exists, return None if not
2941
try:
3042
f = open(filename, "rb")

0 commit comments

Comments
 (0)