-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Christian Theune wrote:
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?
Put the new code in a separate function, test that function, and then call it from within 'initialize' (i.e., don't worry about testing that it gets called).
I'd like to get this fix into in Zope 2.11.
+1. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIpEJk+gerLs4ltQ4RApURAKCC8WY/d0hT+PygAie+e7t3PzsppACgrmau u/+Tx9AGnerhxf5PXX5vP0c= =uyvv -----END PGP SIGNATURE-----