[Zope-CVS] CVS: Products/Ape/lib/apelib/fs - base.py:1.3

Shane Hathaway shane@zope.com
Sun, 18 May 2003 00:17:00 -0400


Update of /cvs-repository/Products/Ape/lib/apelib/fs
In directory cvs.zope.org:/tmp/cvs-serv23359/fs

Modified Files:
	base.py 
Log Message:
Made the standard SQL gateways static rather than dependent on a
particular database connection.  This is another step toward
simplifying the configuration of mappers.  The change involved the
following:

- Refactored the query generator to generate only one query at a
time.  Gateways no longer use it directly.  Instead, they ask the
database connection to generate a query.  The database connection
caches the generated query.

- Added a setUp method to gateways.  The setUp method can check the
interface of the connection and/or create tables.

- Consolidated the set up procedure for SQL gateways into setUp().

- Added an argument to the execute() method of SQLGatewayBase so it
can find the connection.

- Arranged for ApeStorage to call gateway.setUp().



=== Products/Ape/lib/apelib/fs/base.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/fs/base.py:1.2	Sat May 17 20:47:00 2003
+++ Products/Ape/lib/apelib/fs/base.py	Sun May 18 00:16:29 2003
@@ -33,3 +33,9 @@
     def getConnection(self, event):
         return event.getConnection(self.conn_name)
 
+    def setUp(self, event, clear_all=0):
+        conn = self.getConnection(event)
+        if not IFSConnection.isImplementedBy(conn):
+            raise ValueError(
+                "%s does not implement IFSConnection" % repr(conn))
+