[Checkins] SVN: zc.twist/trunk/ Make tests pass with ZODB 3.9

Zvezdan Petkovic zvezdan at zope.com
Fri May 29 11:16:36 EDT 2009


Log message for revision 100535:
  Make tests pass with ZODB 3.9
  
  

Changed:
  _U  zc.twist/trunk/
  U   zc.twist/trunk/CHANGES.txt
  U   zc.twist/trunk/setup.py
  U   zc.twist/trunk/src/zc/twist/__init__.py

-=-

Property changes on: zc.twist/trunk
___________________________________________________________________
Modified: svn:ignore
   - develop-eggs
bin
parts
.installed.cfg

   + .installed.cfg
bin
build
develop-eggs
dist
eggs
parts
TEST_THIS_REST_BEFORE_REGISTERING.txt


Modified: zc.twist/trunk/CHANGES.txt
===================================================================
--- zc.twist/trunk/CHANGES.txt	2009-05-29 12:50:50 UTC (rev 100534)
+++ zc.twist/trunk/CHANGES.txt	2009-05-29 15:16:36 UTC (rev 100535)
@@ -1,8 +1,11 @@
-(unreleased)
-------------
+1.4 (unreleased)
+----------------
 
-* added missing import of twisted.python.failure
+* Added missing import of twisted.python.failure.
 
+* Use db.pool with ZODB >= 3.9 and db._pools with ZODB < 3.9.
+  The tests now pass with ZODB 3.9.
+
 1.3 (2008-06-19)
 ----------------
 

Modified: zc.twist/trunk/setup.py
===================================================================
--- zc.twist/trunk/setup.py	2009-05-29 12:50:50 UTC (rev 100534)
+++ zc.twist/trunk/setup.py	2009-05-29 15:16:36 UTC (rev 100535)
@@ -64,7 +64,7 @@
 
 setup(
     name='zc.twist',
-    version='1.3',
+    version='1.4dev',
     packages=find_packages('src'),
     url='http://pypi.python.org/pypi/zc.twist',
     package_dir={'':'src'},

Modified: zc.twist/trunk/src/zc/twist/__init__.py
===================================================================
--- zc.twist/trunk/src/zc/twist/__init__.py	2009-05-29 12:50:50 UTC (rev 100534)
+++ zc.twist/trunk/src/zc/twist/__init__.py	2009-05-29 15:16:36 UTC (rev 100535)
@@ -79,21 +79,17 @@
     return obj
 
 def availableConnectionCount(db, version=''):
-    # we're entering into protected name land :-(  It would be nice to
-    # have APIs to get the current pool size, and available pool size in
-    # addition to the target pool size
-    try:
+    try:                    # ZODB 3.9 and newer
+        pool = db.pool
+    except AttributeError:  # ZODB 3.8 and older
         pools = db._pools
-    except AttributeError:
-        return True # TODO: log this
-    else:
         pool = pools.get(version)
         if pool is None:
             return True
-        size = db.getPoolSize()
-        all = len(pool.all)
-        available = len(pool.available) + (size - all)
-        return available
+    size = db.getPoolSize()
+    all = len(pool.all)
+    available = len(pool.available) + (size - all)
+    return available
 
 missing = object()
 



More information about the Checkins mailing list