Re: [Zope-dev] DBTab/Mountpoint bug
On Thu, 2008-08-14 at 10:34 -0400, Tres Seaver wrote: > 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 thought there would be more to it and didn't think that this would solve my problem. But actually it does. Thanks for the pointer. > > I'd like to get this fix into in Zope 2.11. > > +1. :) -- 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 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 )
Re: [Zope-dev] DBTab/Mountpoint bug
-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 [EMAIL PROTECTED] 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- ___ 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 )
[Zope-dev] DBTab/Mountpoint bug
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 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 )