From 23287d7e4ac665dc2c02f8f9dbe751f657ad80bb Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 4 Apr 2007 14:03:23 +0000 Subject: [PATCH] Add missing closeConnection method. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13937 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZMySQLDA/db.py | 14 ++++++++++++++ product/ZMySQLDDA/db.py | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/product/ZMySQLDA/db.py b/product/ZMySQLDA/db.py index 6d35d6565d..f9ac6aaa71 100644 --- a/product/ZMySQLDA/db.py +++ b/product/ZMySQLDA/db.py @@ -242,6 +242,20 @@ class ThreadedDB: finally: self._db_lock.release() + def _pool_del(self, key): + self._db_lock.acquire() + try: + del self._db_pool[key] + finally: + self._db_lock.release() + + def closeConnection(self): + ident = get_ident() + try: + self._pool_del(ident) + except KeyError: + pass + def _access_db(self, method_id, args, kw): """ Generic method to call pooled objects' methods. diff --git a/product/ZMySQLDDA/db.py b/product/ZMySQLDDA/db.py index a44359639f..8d666378ac 100644 --- a/product/ZMySQLDDA/db.py +++ b/product/ZMySQLDDA/db.py @@ -240,6 +240,20 @@ class ThreadedDeferredDB: finally: self._db_lock.release() + def _pool_del(self, key): + self._db_lock.acquire() + try: + del self._db_pool[key] + finally: + self._db_lock.release() + + def closeConnection(self): + ident = get_ident() + try: + self._pool_del(ident) + except KeyError: + pass + def _access_db(self, method_id, args, kw): """ Generic method to call pooled objects' methods. -- 2.30.9