[Zope-CVS] CVS: Products/Ape/lib/apelib/zope2 - sqlmapper.py:1.5

Shane Hathaway shane@zope.com
Mon, 19 May 2003 15:32:36 -0400


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

Modified Files:
	sqlmapper.py 
Log Message:
Provided new machinery for initializing databases, especially creating
tables.

- Added two new interfaces, IDatabaseInitializer and
IDatabaseInitEvent.  The initializer.init(event) gets called when new
connections are made to the database.

- All gateways in the sql subpackage now implement IDatabaseInitializer.

- Added methods to mappers for configuring and using initializers.

- Renamed setUp() to init(), since it's easier to spell.

- Avoided calling initializers more than once.

- Renamed 'object' to 'obj' in some places.



=== Products/Ape/lib/apelib/zope2/sqlmapper.py 1.4 => 1.5 ===
--- Products/Ape/lib/apelib/zope2/sqlmapper.py:1.4	Sun May 18 00:16:31 2003
+++ Products/Ape/lib/apelib/zope2/sqlmapper.py	Mon May 19 15:32:36 2003
@@ -39,6 +39,19 @@
     classification_gw = classification.SQLClassification()
     keychain_gen = keygen.SQLKeychainGenerator()
 
+    for initializer in (
+        folder_items_gw,
+        item_id_gw,
+        remainder_gw,
+        file_data_gw,
+        modtime_gw,
+        properties_gw,
+        security_gw,
+        userlist_gw,
+        classification_gw,
+        keychain_gen):
+        root_mapper.addInitializer(initializer)
+
     root_mapper.getClassifier().setGateway(classification_gw)
 
     # abstract base gateway