diff options
author | Moshe Zadka <moshez@math.huji.ac.il> | 2000-07-29 05:31:40 (GMT) |
---|---|---|
committer | Moshe Zadka <moshez@math.huji.ac.il> | 2000-07-29 05:31:40 (GMT) |
commit | 7a4409c1b2e16fa2a4a6dbc93d67746dbbab4b5c (patch) | |
tree | 055f2e3446253f264ee6b2fbfd0c94d627bd7e94 /Lib | |
parent | 37c03ff3a95d5518d54364e232c35c50ab469edb (diff) | |
download | cpython-7a4409c1b2e16fa2a4a6dbc93d67746dbbab4b5c.zip cpython-7a4409c1b2e16fa2a4a6dbc93d67746dbbab4b5c.tar.gz cpython-7a4409c1b2e16fa2a4a6dbc93d67746dbbab4b5c.tar.bz2 |
Added support to recognize Python's internal "dumbdbm" database.
This closes bug 200 on Jitterbug.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/whichdb.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/whichdb.py b/Lib/whichdb.py index 4dd4e3a..5806118 100644 --- a/Lib/whichdb.py +++ b/Lib/whichdb.py @@ -25,6 +25,18 @@ def whichdb(filename): except IOError: pass + # Check for dumbdbm next -- this has a .dir and and a .dat file + f = open(filename + ".dat", "rb") + f.close() + f = open(filename + ".dir", "rb") + try: + if f.read(1) in ["'", '"']: + return "dumbdbm" + finally: + f.close() + except IOError: + pass + # See if the file exists, return None if not try: f = open(filename, "rb") |