]> granicus.if.org Git - python/commitdiff
Added support to recognize Python's internal "dumbdbm" database.
authorMoshe Zadka <moshez@math.huji.ac.il>
Sat, 29 Jul 2000 05:31:40 +0000 (05:31 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Sat, 29 Jul 2000 05:31:40 +0000 (05:31 +0000)
This closes bug 200 on Jitterbug.

Lib/whichdb.py

index 4dd4e3a37338b56d62ed78c5b1798bdc5a4929b1..5806118fc9e569dadd4331f3154ec3220777716a 100644 (file)
@@ -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")