git » nmdb » commit 91ce6ff

Fix the contains? test in the Python module.

author Alberto Bertogli
2007-01-08 21:00:23 UTC
committer Alberto Bertogli
2007-01-08 21:00:23 UTC
parent c72b05932bead660956ffae0206213330eeccaa9

Fix the contains? test in the Python module.

python/nmdb.py +3 -3

diff --git a/python/nmdb.py b/python/nmdb.py
index 7cea957..caa5663 100644
--- a/python/nmdb.py
+++ b/python/nmdb.py
@@ -102,11 +102,11 @@ class _nmdbDict (object):
 	def __contains__(self, key):
 		"Returns True if the key is in the database, False otherwise."
 		if self.autopickle:
-			key = hash(key)
+			key = str(hash(key))
 		try:
 			r = self.get(key)
-		except:
-			raise NetworkError
+		except KeyError:
+			return False
 		if not r:
 			return False
 		return True