[z3-checkins] r27738 - in z3/sqlos/branch/jinty-sqlobject2: . src/sqlos src/sqlos/ftests src/sqlos/testing src/sqlos/tests

jinty at codespeak.net jinty at codespeak.net
Fri May 26 20:54:25 CEST 2006


Author: jinty
Date: Fri May 26 20:54:17 2006
New Revision: 27738

Added:
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/meta.zcml
      - copied unchanged from r27720, z3/sqlos/branch/jinty-sqlobject2/src/sqlos/meta.zcml
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/metaconfigure.py
      - copied unchanged from r27720, z3/sqlos/branch/jinty-sqlobject2/src/sqlos/metaconfigure.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/metadirectives.py
      - copied unchanged from r27720, z3/sqlos/branch/jinty-sqlobject2/src/sqlos/metadirectives.py
Modified:
   z3/sqlos/branch/jinty-sqlobject2/makefile
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/_transaction.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/configure.zcml
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/connection.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/container.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftesting.zcml
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftests/test_transaction.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/interfaces.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/sampleperson.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/testdb.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_doctests.py
   z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_transaction.py
Log:
Do a huge wack of porting, unit tests work now, functional tests not. We only support sqlite at the moment;)

Modified: z3/sqlos/branch/jinty-sqlobject2/makefile
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/makefile	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/makefile	Fri May 26 20:54:17 2006
@@ -45,7 +45,7 @@
 	cp $< $@
 
 .PHONY: sqlos-meta
-sqlos-meta: $(z3includes)/sqlos-meta.zcml $(z3includes)/sqlos-configure.zcml $(z3includes)/sqlos-ftesting.zcml
+sqlos-meta: $(z3includes)/sqlos-configure.zcml $(z3includes)/sqlos-ftesting.zcml
 
 .PHONY: Zope3-build
 Zope3-build: Zope3

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/_transaction.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/_transaction.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/_transaction.py	Fri May 26 20:54:17 2006
@@ -28,81 +28,10 @@
 import transaction
 from transaction.interfaces import ISynchronizer
 from zope.interface import implements
-from sqlobject.cache import CacheSet
 from zope.thread import local
 
 from sqlos.interfaces import ISQLObject
 
-
-class CacheSynchronizer:
-    """Synchronizer to expire the Global per thread cache at transaction start.
-
-    Basically just an adapter for sqlobject.cache.CacheSet.
-
-    Lets make a stub context:
-
-        >>> class CacheStub:
-        ...     def __init__(self, name):
-        ...         self.name = name
-        ...     def clear(self):
-        ...         print 'clearing %s' % self.name
-        >>> class CacheSetStub:
-        ...     def allSubCaches(self):
-        ...         return self.caches
-        >>> cache_set_stub = CacheSetStub()
-        >>> cache_set_stub.caches = [CacheStub('cache 1'), CacheStub('cache 2')]
-
-    Let's check that it implements the interface correctly:
-
-        >>> from zope.interface import verify
-        >>> synch = CacheSynchronizer(cache_set_stub)
-        >>> verify.verifyObject(ISynchronizer, synch)
-        True
-
-    Nothing Happens before or after transactions:
-
-        >>> synch.beforeCompletion('fake txn')
-        >>> synch.afterCompletion('fake txn')
-
-    But on new transactions, the cache is cleared:
-
-        >>> synch.newTransaction('fake txn')
-        clearing cache 1
-        clearing cache 2
-    """
-    # XXX this is probably the wrong place to put this code.
-    implements(ISynchronizer)
-
-    def __init__(self, context):
-        # context must be a CacheSet but SQLObject aint goit interfaces
-        self.context = context
-
-    def afterCompletion(self, transaction):
-        pass
-
-    def beforeCompletion(self, transaction):
-        pass
-
-    def newTransaction(self, transaction):
-        for cache in self.context.allSubCaches():
-            cache.clear() # Blech, not optimal, don't know what is.
-                          # expireAll, doesn't expire the objects.
-
-
-class ThreadedCacheManager(local):
-
-    def __init__(self):
-        self.cache = CacheSet() # one cache per thread
-        # we need to keep a solid reference to the synchronizer, because the
-        # transaction manager only keeps weak ones
-        self._synch = CacheSynchronizer(self.cache)
-        transaction.manager.registerSynch(self._synch)
-
-cache_manager = ThreadedCacheManager() # this should be a utility?
-                                       # waa actually I don't like this at all
-                                       # there must be a dead simple way.
-
-
 class DirtyObjectRegistry(local):
     """A thread local registry of dirty SQLObjects.
 
@@ -266,7 +195,10 @@
         while self._objects:
             obj = self._objects.pop()
             if not obj.sqlmeta._obsolete:
-                obj.syncUpdate()
+                # XXX: we don't need the sync, just syncUpdate, but SQLObject2
+                # doesn't support that yet
+                #obj.syncUpdate()
+                obj.sync()
 
     def  _addBeforeCommitHook(self):
         self._txn.addBeforeCommitHook(self.syncUpdateAll, ())

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/configure.zcml
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/configure.zcml	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/configure.zcml	Fri May 26 20:54:17 2006
@@ -33,7 +33,7 @@
 
   <adapter
       provides="zope.app.container.interfaces.INameChooser"
-      for="sqlos.interfaces.container.ISQLObjectContainer"
+      for="sqlos.interfaces.ISQLObjectContainer"
       permission="zope.Public"
       factory=".container.SQLObjectNameChooser"
       />
@@ -41,20 +41,20 @@
   <!-- Default view for containers. Should we really be specifying this??-->
 
   <browser:defaultView
-      for="sqlos.interfaces.container.ISQLObjectContainer"
+      for="sqlos.interfaces.ISQLObjectContainer"
       name="contents.html"
       />
 
   <browser:page
       name="contents.html"
       menu="zmi_views" title="Contents"
-      for=".interfaces.container.ISQLObjectContainer"
+      for=".interfaces.ISQLObjectContainer"
       permission="zope.ManageContent"
       class="zope.app.container.browser.contents.Contents"
       attribute="contents"
       />
 
-  <class class=".adapter.MySQLAdapter">
+  <!-- <class class=".adapter.MySQLAdapter">
     <require
         permission="zope.Public"
         interface=".interfaces.IZopeSQLConnection"
@@ -73,28 +73,7 @@
         permission="zope.Public"
         interface=".interfaces.IZopeSQLConnection"
         />
-  </class>
-
-  <class class="sqlobject.cache.CacheSet">
-    <require
-        permission="zope.Public"
-        interface=".interfaces.ICacheSet"
-        />
-  </class>
-
-  <class class="sqlobject.main.SelectResults">
-    <require
-        permission="zope.Public"
-        interface=".interfaces.ISelectResults"
-        />
-  </class>
-
-  <class class="sqlobject.dbconnection.Iteration">
-    <require
-        permission="zope.Public"
-        interface=".interfaces.IIterator"
-        />
-  </class>
+  </class>-->
 
   <!--
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -110,15 +89,15 @@
       />
   -->
 
+  <!-- if this doesnt work, you need a new version of mysqldbda
   <configure zcml:condition="installed mysqldbda">
-    <!-- if this doesnt work, you need a new version of mysqldbda-->
     <adapter
         provides=".interfaces.IZopeSQLConnection"
         for="mysqldbda.adapter.IMySQLZopeConnection"
         permission="zope.Public"
         factory=".adapter.MySQLAdapter"
         />
-  </configure>
+  </configure>-->
 
   <subscriber
       for="zope.app.component.interfaces.ISite

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/connection.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/connection.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/connection.py	Fri May 26 20:54:17 2006
@@ -14,7 +14,47 @@
 """
 __metaclass__ = type
 
+import zope.component
 from zope.thread import local
+from zope.rdb.interfaces import IZopeDatabaseAdapter
+from sqlapi.backend.sqlite import SQLitePlugin
+from sqlapi.connect.wrapper import ConnectionWrapper
+
+from sqlos.interfaces import ISQLAPIConnection
+
+class ZopeConnectionHub:
+
+    def __init__(self, connection_name=None, adapter=None):
+        assert not (adapter is None and connection_name is None)
+        self.adapter = adapter
+        self.connection_name = connection_name
+
+    def get_connection(self):
+        # get the Zope3 connection by that name
+        adapter = self.adapter
+        if adapter is None:
+            adapter = zope.component.getUtility(IZopeDatabaseAdapter,
+                                                self.connection_name)
+
+
+        # XXX this needs to become an adapter call so we can support different
+        # databases....
+        url = adapter.dsn.replace('dbi', 'sqlite')
+        args = SQLitePlugin.parse_uri(url)
+        plugin = SQLitePlugin(**args)
+        # override the connection
+        def raw_connection():
+            return adapter()
+        plugin.raw_connection = raw_connection
+        return ConnectionWrapper(plugin)
+
+def makeSQLiteConnectionAdapter(context):
+    def raw_connection(self):
+        return context
+    info = context.getTypeInfo()
+    plugin = SQLitePlugin('dummy')
+    plugin.raw_connection = raw_connection
+    return ConnectionWrapper(plugin)
 
 class ConnectionCache(local):
     """A per thread cache for adapted connections."""

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/container.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/container.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/container.py	Fri May 26 20:54:17 2006
@@ -28,8 +28,8 @@
 from zope.app.exception.interfaces import UserError
 
 from sqlos.interfaces import ISQLObject, ISQLObjectIsolated, IISQLObject
-from sqlos.interfaces.container import ISQLObjectContainer
-from sqlos.interfaces.container import IIsolatedSQLContainer
+from sqlos.interfaces import ISQLObjectContainer
+from sqlos.interfaces import IIsolatedSQLContainer
 
 def contained(obj, parent=None, name=None):
     """An implementation of zope.app.container.contained.contained

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftesting.zcml
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftesting.zcml	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftesting.zcml	Fri May 26 20:54:17 2006
@@ -11,13 +11,11 @@
        You should only need to change the connectionName in order to
        test against a different database that sqlite -->
 
-  <sqlos:connectionName name='sqlite' />
-
   <adapter
-      provides=".interfaces.IZopeSQLConnection"
-      for="zope.app.rdb.interfaces.IZopeConnection"
+      provides=".interfaces.ISQLAPIConnection"
+      for="zope.rdb.interfaces.IZopeConnection"
       permission="zope.Public"
-      factory=".adapter.SQLiteAdapter"
+      factory=".connection.makeSQLiteConnectionAdapter"
       />
 
   <rdb:provideConnection
@@ -47,31 +45,27 @@
   <!-- Register Facotries for Dogs and Sample Isolated People for
        low level testing -->
 
-  <sqlos:factory
-      id="Dog"
+  <utility
+      name="Dog"
       component=".testing.sampleperson.Dog"
-      description="A Sample Dog"
+      provides="sqlos.interfaces.IISQLObject"
       />
 
-  <sqlos:factory
-      id="SampleIsolatedPerson"
+  <utility
+      name="SampleIsolatedPerson"
       component=".testing.sampleperson.SampleIsolatedPerson"
-      description="A Sample Person for isolated containers"
+      provides="sqlos.interfaces.IISQLObject"
       />
 
   <!-- Define a Sample Person with some views so we can test through the ZMI -->
 
-  <sqlos:factory
-      id="sqlos.somename.SamplePerson"
+  <utility
+      name="sqlos.somename.SamplePerson"
       component=".testing.sampleperson.SamplePerson"
-      description="A Sample Person"
+      provides="sqlos.interfaces.IISQLObject"
       />
 
   <content class=".testing.sampleperson.SamplePerson">
-    <!-- The followinf factory directive is actually uneccessary and
-         probably a bad idea as sqlos:factory with register the factory.
-         It is included here as a decoy to be sure that sqlos still functions
-         when it is present. -->
     <factory
         id="sqlos.Sampleperson"
         title="SamplePerson Factory"

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftests/test_transaction.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftests/test_transaction.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/ftests/test_transaction.py	Fri May 26 20:54:17 2006
@@ -18,9 +18,10 @@
 from zope.app.testing.functional import BrowserTestCase
 import zope.component
 from zope.app.rdb.interfaces import IZopeDatabaseAdapter
+from sqlobject.manage.creation import create_tables
 
 from sqlos.interfaces import IConnectionName
-from sqlos.testing.sampleperson import SamplePerson
+from sqlos.testing.sampleperson import SamplePerson, test_hub
 
 __metaclass__ = type
 
@@ -28,7 +29,7 @@
 
     def setUp(self):
         super(TestTransaction, self).setUp()
-        SamplePerson.createTable(ifNotExists=True)
+        create_tables([SamplePerson])
         person = SamplePerson(fullname='Sidnei da Silva',
                               username='sidnei',
                               password='test')
@@ -48,7 +49,8 @@
         person.fullname = 'Sidnei Silva'
         person.username = 'dreamcatcher'
         person.password = 'pass'
-        person.syncUpdate() # XXX - This sync should not be necessary but is
+        # XXX: ???
+        #person.syncUpdate() # XXX - This sync should not be necessary but is
                             # unless _cacheValues=False is removed from
                             # SamplePerson - jinty
         self.assertEqual(person.fullname, 'Sidnei Silva')
@@ -149,8 +151,8 @@
         This is a regression test for if the cache makes breaks the isolation
         between threads.
         """
-        ut = zope.component.getUtility(IConnectionName)
-        adapter = zope.component.queryUtility(IZopeDatabaseAdapter, ut.name)
+        name = test_hub.connection_name ## XXX: ugh fragile
+        adapter = zope.component.queryUtility(IZopeDatabaseAdapter, name)
         if adapter.getDSN() == 'dbi://:memory:':
             import warnings
             warnings.warn('Warning, not testing Cache Isolation')
@@ -181,8 +183,8 @@
         happen even if the thread is not the main thread. (Just in case some
         dodo only registers the cache clearer in the main thread.)
         """
-        ut = zope.component.getUtility(IConnectionName)
-        adapter = zope.component.queryUtility(IZopeDatabaseAdapter, ut.name)
+        name = test_hub.connection_name ## XXX: ugh fragile
+        adapter = zope.component.queryUtility(IZopeDatabaseAdapter, name)
         if adapter.getDSN() == 'dbi://:memory:':
             import warnings
             warnings.warn('Warning, not testing Cache Isolation')
@@ -224,9 +226,9 @@
 
     def tearDown(self):
         person = SamplePerson.get(self.personid)
-        person.destroySelf()
+        person.destroy_self()
         super(TestTransaction, self).tearDown()
-        SamplePerson.dropTable()
+        SamplePerson.sqlmeta.drop_table()
         get().commit()
         begin()
 

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/interfaces.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/interfaces.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/interfaces.py	Fri May 26 20:54:17 2006
@@ -50,6 +50,9 @@
 class IISQLObject(Interface):
     """Class methods for SQLObject classes."""
 
+class ISQLAPIConnection(Interface):
+    """A marker interface for SQL API connections"""
+
 
 class IISQLObjectIsolated(IISQLObject):
     """Support for using this class in isolated containers.

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/sampleperson.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/sampleperson.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/sampleperson.py	Fri May 26 20:54:17 2006
@@ -3,10 +3,13 @@
 from zope.interface import implements, classProvides, Interface
 from zope.schema import TextLine, Text, Datetime
 from zope.app.container import constraints
+from sqlobject.manage.creation import create_tables
 
-from sqlos.interfaces import ISQLSchema, IISQLObjectIsolated, ISQLObjectIsolated
-from sqlos.interfaces.container import ISQLObjectContainer
+from sqlos.interfaces import ISQLObject, IISQLObjectIsolated, ISQLObjectIsolated, ISQLObjectContainer
 from sqlos.container import SQLObjectContainer, SQLIsolatedContainer
+from sqlos.connection import ZopeConnectionHub
+
+test_hub = ZopeConnectionHub('sqlite')
 
 def createTestingTablesSubscriber(obj):
     # An event subscriber that can be used to create the testing tables
@@ -15,21 +18,22 @@
 def createTestingTables():
     """Creates the tables of the SQLObject calsses defined here."""
     transaction.get().commit()
-    for table in [SamplePerson, SampleIsolatedPerson, Dog]:
-        if table._connection.tableExists(table.sqlmeta.table):
-            print 'WARNING: Table already exists. Dirty test???'
-        table.createTable(ifNotExists=True)
+    create_tables([SamplePerson, SampleIsolatedPerson, Dog])
+    #for table in [SamplePerson, SampleIsolatedPerson, Dog]:
+    #    if table._connection.tableExists(table.sqlmeta.table):
+    #        print 'WARNING: Table already exists. Dirty test???'
+    #    table.createTable(ifNotExists=True)
     transaction.get().commit()
 
 def dropTestingTables():
     """Creates the tables of the SQLObject calsses defined here."""
     transaction.get().commit()
     for table in [SamplePerson, SampleIsolatedPerson, Dog]:
-        table.dropTable()
+        table.sqlmeta.drop_table()
     transaction.get().commit()
 
 
-class IPerson(ISQLSchema):
+class IPerson(ISQLObject):
 
     fullname = TextLine(title=u'Full Name',
                         description=u"The full name of the user")
@@ -43,7 +47,6 @@
 
     constraints.contains(IPerson)
 
-
 class IPersonContained(Interface):
 
     constraints.containers(IPersonContainer)
@@ -58,6 +61,9 @@
 
     implements(IPerson, IPersonContained)
 
+    class sqlmeta:
+        connection_hub = test_hub
+
     fullname = StringCol(length=50, notNull=1)
     username = StringCol(length=20, notNull=1)
     password = StringCol(length=20, notNull=1)
@@ -68,6 +74,9 @@
     classProvides(IISQLObjectIsolated)
     implements(IPerson, ISQLObjectIsolated)
 
+    class sqlmeta:
+        connection_hub = test_hub
+
     # Using a StringCol for a list is probably not the right way to do things
     # from a Relational Database point of view, better would be some kind of
     # join.
@@ -76,18 +85,22 @@
     username = StringCol(length=20, notNull=1)
     password = StringCol(length=20, notNull=1)
 
-    def _get_domains(self):
-        domains = self._SO_get_domains()
-        if domains == "":
-            return ()
-        return tuple(domains.split('/'))
-
-    def _set_domains(self, value):
-        for v in value:
-            if '/' in v:
-                raise ValueError("This implementation does not work with"
-                                 " domains containing /")
-        self._SO_set_domains('/'.join(tuple(value)))
+    class domains(StringCol):
+
+        default = ""
+
+        def get(self, obj, raw_get):
+            domains = raw_get(obj)
+            if domains == "":
+                return ()
+            return tuple(domains.split('/'))
+
+        def set(self, obj, value, raw_set):
+            for v in value:
+                if '/' in v:
+                    raise ValueError("This implementation does not work with"
+                                     " domains containing /")
+            raw_set(obj, '/'.join(tuple(value)))
 
     def countByDomain(self, domain):
         """Very un-optimized."""
@@ -111,7 +124,7 @@
     implements(IPersonContainer)
 
 
-class IDog(ISQLSchema):
+class IDog(ISQLObject):
 
     fullname = TextLine(title=u'Full Name',
                         description=u'The full name of the dog')
@@ -123,6 +136,9 @@
 
     implements(IDog)
 
+    class sqlmeta:
+        connection_hub = test_hub
+
     fullname = StringCol(length=50, notNull=1)
     owner = StringCol(length=20, notNull=1)
 

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/testdb.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/testdb.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/testing/testdb.py	Fri May 26 20:54:17 2006
@@ -19,15 +19,29 @@
 
 import transaction
 from zope.app.rdb import ZopeDatabaseAdapter
-
-from sqlos.adapter import SQLiteAdapter
-
-# Try first to use pysqlite2
-try:
-    from pysqlite2 import dbapi2 as sqlite
-except ImportError:
-    import sqlite
-
+from sqlobject.manage.creation import create_tables
+from sqlapi.backend.sqlite import SQLitePlugin
+from sqlapi.connect.wrapper import ConnectionWrapper
+
+#from sqlos.adapter import SQLiteAdapter
+from sqlos.connection import ZopeConnectionHub
+
+from pysqlite2 import dbapi2 as sqlite
+
+class SQLiteTestConnectionHub:
+    
+    def __init__(self, adapter):
+        self.adapter = adapter
+    
+    def get_connection(self):
+        url = self.adapter.dsn.replace('dbi', 'sqlite')
+        args = SQLitePlugin.parse_uri(url)
+        plugin = SQLitePlugin(**args)
+        # override the connection
+        def raw_connection():
+            return self.adapter()
+        plugin.raw_connection = raw_connection
+        return ConnectionWrapper(plugin)
 
 class SQLiteda(ZopeDatabaseAdapter):
     """A not very fancy SQLLite database adapter."""
@@ -52,33 +66,23 @@
         if createTables is true, then .createTable(ifNotExists=True) will be
         called on all classes.
         """
-        self.conn = None
         if classes is None:
             classes = []
-        self.zda = SQLiteda('dbi://:memory:')
+        hub = SQLiteTestConnectionHub(SQLiteda('dbi://:memory:'))
         self.history = []  # store the original connection and classes
         for cls in classes:
-            self.history.append((cls, cls._connection))
-            cls._connection = self.getConnection()
-            if createTables:
-                cls.createTable(ifNotExists=True)
+            self.history.append((cls, cls.sqlmeta.connection_hub))
+            cls.sqlmeta.connection_hub = hub
+        create_tables(classes)
+        transaction.commit()
             
-    def connectionAdapterFactory(self):
-        return SQLiteAdapter(self.zda())
-
-    def getConnection(self):
-        if self.conn is None:
-            self.conn = self.connectionAdapterFactory()
-        return self.conn
-
-    def tearDown(self, dropTables=True):
+    def tearDown(self):
         # Drop the tables
         transaction.commit()
-        if dropTables:
-            for cls, oldconn in self.history:
-                cls.dropTable()
+        for cls, oldconn in self.history:
+            cls.sqlmeta.drop_table()
         #commit
         transaction.commit()
         # clean up the connections
         for cls, oldconn in self.history:
-            cls._connection = oldconn
+            cls.sqlmeta.connection_hub = oldconn

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_doctests.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_doctests.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_doctests.py	Fri May 26 20:54:17 2006
@@ -26,5 +26,4 @@
             DocTestSuite('sqlos.container', optionflags=doctest.ELLIPSIS),
             DocTestSuite('sqlos.connection'),
             DocTestSuite('sqlos._transaction'),
-            DocTestSuite('sqlos.zsqlobject')
             ])

Modified: z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_transaction.py
==============================================================================
--- z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_transaction.py	(original)
+++ z3/sqlos/branch/jinty-sqlobject2/src/sqlos/tests/test_transaction.py	Fri May 26 20:54:17 2006
@@ -54,7 +54,7 @@
         >>> get().commit()
         >>> txn = begin()
         >>> person.username
-        'andres'
+        u'andres'
 
     And finally call tearDown and cleanup:
 


More information about the z3-checkins mailing list