[Zope-dev] DBTab/Mountpoint bug

Christian Theune ct at gocept.com
Thu Aug 14 09:18:13 EDT 2008


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 · ct at gocept.com
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080814/9dd9636e/attachment.bin 


More information about the Zope-Dev mailing list