[z3-checkins] r23341 - z3/sqlos/trunk/src/sqlos

jinty at codespeak.net jinty at codespeak.net
Tue Feb 14 20:53:17 CET 2006


Author: jinty
Date: Tue Feb 14 20:52:18 2006
New Revision: 23341

Modified:
   z3/sqlos/trunk/src/sqlos/_sqlos.py
   z3/sqlos/trunk/src/sqlos/adapter.py
Log:
Commit a failing test (that should pass), and a TODO item.

Modified: z3/sqlos/trunk/src/sqlos/_sqlos.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/_sqlos.py	(original)
+++ z3/sqlos/trunk/src/sqlos/_sqlos.py	Tue Feb 14 20:52:18 2006
@@ -35,6 +35,15 @@
         >>> verifyObject(ISQLObject, s)
         True
 
+    We should not be able to override the _connection attribute on an instance:
+
+        >>> tmpcon = s._connection
+        >>> obj = 'x'
+        >>> s._connection = obj
+        >>> s._connection is not obj
+        True
+        >>> s._connection = tmpcon # if this test fails, we don't want to break others
+
     And finally call tearDown and cleanup:
 
         >>> testdb.tearDown()

Modified: z3/sqlos/trunk/src/sqlos/adapter.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/adapter.py	(original)
+++ z3/sqlos/trunk/src/sqlos/adapter.py	Tue Feb 14 20:52:18 2006
@@ -24,6 +24,12 @@
 from sqlos._transaction import SQLObjectTransactionManager
 from sqlos._transaction import getGlobalPerThreadCache
 
+# TODO: it is probably possible to optimize this by not creating a
+# ConnectionAdapter every adapter lookup, but rather caching one per thread,
+# and stuffing the connection into it using a factory function. Probably there
+# would be one factory function per adapter type and we could get rid of the
+# cache property on the ConnectionAdapter.
+
 class ConnectionAdapter:
 
     def __init__(self, connection):


More information about the z3-checkins mailing list