git » nmdb » commit 0258571

Mark as internal some variables in the Python bindings.

author Alberto Bertogli
2007-04-29 07:06:36 UTC
committer Alberto Bertogli
2007-04-29 07:06:36 UTC
parent 0b5e59e0a4f23033460151b74a090c6629a17c06

Mark as internal some variables in the Python bindings.

The Python bindings exposes "get", "set", "del" functions, which are
actually direct calls to the low level module and are not meant to
be used (they are undocumented, the return values are strange,
etc.).

This patch makes them begin with an underscore to note the fact they
are internal and not made to be used.

bindings/python/nmdb.py +9 -9

diff --git a/bindings/python/nmdb.py b/bindings/python/nmdb.py
index d0d2eba..1363a54 100644
--- a/bindings/python/nmdb.py
+++ b/bindings/python/nmdb.py
@@ -51,16 +51,16 @@ class NetworkError (Exception):
 
 class _nmdbDict (object):
 	def __init__(self, db, op_get, op_set, op_delete, op_cas):
-		self.db = db
-		self.get = op_get
-		self.set = op_set
-		self.delete = op_delete
+		self._db = db
+		self._get = op_get
+		self._set = op_set
+		self._delete = op_delete
 		self._cas = op_cas
 		self.autopickle = True
 
 	def add_server(self, port):
 		"Adds a server to the server pool."
-		rv = self.db.add_server(port)
+		rv = self._db.add_server(port)
 		if not rv:
 			raise NetworkError
 		return rv
@@ -70,7 +70,7 @@ class _nmdbDict (object):
 		if self.autopickle:
 			key = str(hash(key))
 		try:
-			r = self.get(key)
+			r = self._get(key)
 		except:
 			raise NetworkError
 		if not r:
@@ -84,7 +84,7 @@ class _nmdbDict (object):
 		if self.autopickle:
 			key = str(hash(key))
 			val = cPickle.dumps(val, protocol = -1)
-		r = self.set(key, val)
+		r = self._set(key, val)
 		if r <= 0:
 			raise NetworkError
 		return 1
@@ -93,7 +93,7 @@ class _nmdbDict (object):
 		"del d[k]   Deletes the key k."
 		if self.autopickle:
 			key = str(hash(key))
-		r = self.delete(key)
+		r = self._delete(key)
 		if r < 0:
 			raise NetworkError
 		elif r == 0:
@@ -105,7 +105,7 @@ class _nmdbDict (object):
 		if self.autopickle:
 			key = str(hash(key))
 		try:
-			r = self.get(key)
+			r = self._get(key)
 		except KeyError:
 			return False
 		if not r: