Hi,

Zope 2's multi-database support has a bug: it doesn't connect the
registered databases into a multi-database structure unless someone
traverses over the mount point objects.

This makes local component registration that spans multiple database
problematic because you have to first traverse over all mountpoints,
before using `getUtility` etc.

Here's a patch that fixes the problem. It needs to be applied to
lib/python/Products/ZODBMountPoint:

Index: __init__.py
===================================================================
--- __init__.py (revision 2957)
+++ __init__.py (working copy)
@@ -25,6 +25,9 @@
                       MountedObject.manage_getMountStatus,
                       MountedObject.manage_addMounts,),
         )
-
-
-
+    # Open all DBTab databases once, so they get registered with the
+    # multi-database data structure and can later be opened
automagically with
+    # ZODB's get_connection function.
+    dbtab = MountedObject.getConfiguration()
+    for name in dbtab.listDatabaseNames():
+        dbtab.getDatabase(name=name)

However, I don't see a good way to write a test for this. Any ideas? How
do I test product initialisation code?

I'd like to get this fix into in Zope 2.11.

Christian

-- 
Christian Theune · [EMAIL PROTECTED]
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to