From: Moshe Zadka Date: Sat, 29 Jul 2000 05:31:40 +0000 (+0000) Subject: Added support to recognize Python's internal "dumbdbm" database. X-Git-Tag: v2.0b1~690 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a4409c1b2e16fa2a4a6dbc93d67746dbbab4b5c;p=thirdparty%2FPython%2Fcpython.git Added support to recognize Python's internal "dumbdbm" database. This closes bug 200 on Jitterbug. --- diff --git a/Lib/whichdb.py b/Lib/whichdb.py index 4dd4e3a37338..5806118fc9e5 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")