[Zope-CVS] CVS: Products/Ape/lib/apelib/core - gateways.py:1.4 interfaces.py:1.5 schemas.py:1.3
Shane Hathaway
shane@zope.com
Sun, 18 May 2003 00:16:59 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/core
In directory cvs.zope.org:/tmp/cvs-serv23359/core
Modified Files:
gateways.py interfaces.py schemas.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/core/gateways.py 1.3 => 1.4 ===
--- Products/Ape/lib/apelib/core/gateways.py:1.3 Sat May 17 20:47:00 2003
+++ Products/Ape/lib/apelib/core/gateways.py Sun May 18 00:16:28 2003
@@ -55,6 +55,11 @@
res[name] = s
return res
+ def setUp(self, event, clear_all=0):
+ """Initializes the connection to the data source."""
+ for name, gw in self._gws.items():
+ gw.setUp(event, clear_all)
+
def load(self, event):
"""Loads data.
@@ -104,6 +109,9 @@
def getSchema(self):
return self.schema
+
+ def setUp(self, event, clear_all=0):
+ pass
def load(self, event):
# Returns (data, serial)
=== Products/Ape/lib/apelib/core/interfaces.py 1.4 => 1.5 ===
--- Products/Ape/lib/apelib/core/interfaces.py:1.4 Sat May 17 20:47:00 2003
+++ Products/Ape/lib/apelib/core/interfaces.py Sun May 18 00:16:28 2003
@@ -299,6 +299,14 @@
See serial.interfaces.ISchema.
"""
+ def setUp(event, clear_all=0):
+ """Initializes the connection to the data source.
+
+ event is an IGatewayEvent. The clear_all argument is for
+ testing purposes only. If clear_all is set, the gateway
+ clears its database tables.
+ """
+
def load(event):
"""Loads data.
@@ -369,7 +377,8 @@
def makeKeychain(event, name, stored):
"""Returns a new keychain.
- event is an IMapperEvent.
+ event is an IMapperEvent. Additionally, it is always either
+ an ISDEvent or an IGatewayEvent.
name is the name of the subobject.
=== Products/Ape/lib/apelib/core/schemas.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/core/schemas.py:1.2 Fri Apr 11 02:17:49 2003
+++ Products/Ape/lib/apelib/core/schemas.py Sun May 18 00:16:28 2003
@@ -71,7 +71,7 @@
res = []
for f in self.fields:
res.extend(f.getColumnDefs())
- return res
+ return tuple(res)
def _add(self, c):
if self.field_names.has_key(c.name):