src/pyams_utils/zodb.py
branchdev-tf
changeset 427 63284c98cdc1
parent 408 cf2304af0fab
--- a/src/pyams_utils/zodb.py	Sat Nov 23 01:24:11 2019 +0100
+++ b/src/pyams_utils/zodb.py	Sat Nov 23 14:57:24 2019 +0100
@@ -83,7 +83,8 @@
     This object can be used to store all settings to be able to open a ZEO connection.
     Note that this class is required only for tasks specifically targeting a ZEO database
     connection (like a ZEO packer scheduler task); for generic ZODB operations, just use a
-    :class:`ZODBConnection` class defined through Pyramid's configuration file.
+    :py:class:`ZODBConnection <pyams_utils.zodb.ZODBConnection>` class defined through Pyramid's
+    configuration file.
 
     Note that a ZEO connection object is a context manager, so you can use it like this:
 
@@ -147,15 +148,15 @@
         :return: tuple containing ZEO client storage and DB object (if *get_storage* argument is
             set to *True*), or only DB object otherwise
         """
-        db = DB((self.server_name, self.server_port),
-                storage=self.storage,
-                username=self.username or '',
-                password=self.password or '',
-                realm=self.server_realm,
-                blob_dir=self.blob_dir,
-                shared_blob_dir=self.shared_blob_dir,
-                wait_timeout=wait_timeout)
-        return (db.storage, db) if get_storage else db
+        zdb = DB((self.server_name, self.server_port),
+                 storage=self.storage,
+                 username=self.username or '',
+                 password=self.password or '',
+                 realm=self.server_realm,
+                 blob_dir=self.blob_dir,
+                 shared_blob_dir=self.shared_blob_dir,
+                 wait_timeout=wait_timeout)
+        return (zdb.storage, zdb) if get_storage else zdb
 
     @property
     def connection(self):
@@ -209,8 +210,8 @@
     if settings is None:
         settings = get_global_registry().settings  # pylint: disable=no-member
     for name, uri in get_uris(settings):
-        db = db_from_uri(uri, name, {})
-        return db.open()
+        zdb = db_from_uri(uri, name, {})
+        return zdb.open()
 
 
 class ZODBConnection:
@@ -248,7 +249,7 @@
         return self._connection
 
     @property
-    def db(self):
+    def db(self):  # pylint: disable=invalid-name
         """Database getter"""
         return self._db
 
@@ -261,8 +262,8 @@
         """Load named connection matching registry settings"""
         for name, uri in get_uris(self.settings):
             if name == self.name:
-                db = db_from_uri(uri, name, {})
-                connection = self._connection = db.open()
+                zdb = db_from_uri(uri, name, {})
+                connection = self._connection = zdb.open()
                 self._db = connection.db()
                 self._storage = self.db.storage
                 return connection