diff roundup/anypy/dbm_.py @ 4383:0d9369d35483

fix up some pre-Python2.6 compatibility issues in the *dbm interface
author Richard Jones <richard@users.sourceforge.net>
date Sat, 10 Jul 2010 03:45:17 +0000
parents 661466ba19cd
children d5da643b3d25
line wrap: on
line diff
--- a/roundup/anypy/dbm_.py	Thu Jul 01 02:20:51 2010 +0000
+++ b/roundup/anypy/dbm_.py	Sat Jul 10 03:45:17 2010 +0000
@@ -2,6 +2,14 @@
 # package containing the various implementations. The "wichdb" module's
 # whichdb() function was moved to the new "dbm" module.
 
+import sys
+if sys.version_info[:2] < (2, 6):
+    def key_in(db, key):
+        return db.has_key(key)
+else:
+    def key_in(db, key):
+        return key in db
+
 try:
     # old school first because <3 had a "dbm" module too...
     import anydbm

Roundup Issue Tracker: http://roundup-tracker.org/