[Zope-dev] ZConfig issue: products and container-class
Hi, I found a problematic corner case in the interaction between two zconfig directives: If I set the products directive to a value other than the standard ones (SOFTWARE_HOME/Products or INSTANCE_HOME/Products) AND set the container-class directive of the zodb_db section to a class that is only available inside the alternate products directory specified above, then Zope completely fails to start-up with a configuration error. Reproducing this error is simple. Just set the products directive to, say, $INSTANCE/../Products; put, say, CMF or Plone in there; add another zodb_db section, for instance: zodb_db mounttest filestorage path $INSTANCE/var/mounttest.fs /filestorage mount-point /mounttest container-class Products.CMFPlone.PloneFolder.PloneFolder /zodb_db Change the container-class directive to a class that only exists in ../Products (like Products.CMFPlone.PloneFolder.PloneFolder or Products.CMFCore.PortalFolder.PortalFolder). Finally, try to startup Zope. It will fail with something like: Error: The object named by Products.CMFPlone.PloneFolder.PloneFolder could not be imported (line 862 in file:///home/leo/opt/enfold/etc/zope.conf) For help, use /opt/zopes/Zope-2.7.2/lib/python/Zope/Startup/run.py -h If you comment out the new zodb_db section, Zope starts up fine, and CMF and Plone work ok, proving that the produtcts directive work on it's own. If instead of commenting out the new zodb_db section, you just move your products back to the standard $INSTANCE_HOME/Products location, Zope also starts up ok, proving that the container-class directive works (or at least doesn't keep Zope from starting up). I'm just mentioning this here before filing a collector entry to see if I'm not forgetting something obvious or if others have found the same behaviour. This behaviour is problematic for Windows users with, say, multiprocessor machines, who want to maintain a consistent setup between various ZEO clients, as this forces them to copy products between instances instead of keeping them in a shared location. It's obvious that the container-class directive is being evaluated much earlier than the products directive. Without delving further into the code, it looks like the container-class directive has an error checking built right into the directive type that tries to import the assigned class, while the products direcive will only be made effective AFTER all ZConfig configuration has been processed... Any pointers? Should this go right into the collector? Cheers, Leo -- Leonardo Rochael Almeida [EMAIL PROTECTED] Enfold Systems - http://www.enfolsystems.com/ ___ 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] ZConfig issue: products and container-class
On Mon, 14 Feb 2005 15:22:38 -0200, Leonardo Rochael Almeida [EMAIL PROTECTED] wrote: It's obvious that the container-class directive is being evaluated much earlier than the products directive. Without delving further into the code, it looks like the container-class directive has an error checking built right into the directive type that tries to import the assigned class, while the products direcive will only be made effective AFTER all ZConfig configuration has been processed... This is a known limitation. You can avoid it by using the PYTHONPATH environment variable instead. -Fred -- Fred L. Drake, Jr.fdrake at gmail.com Zope Corporation ___ 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] ZConfig issue: products and container-class
Em Seg, 2005-02-14 às 13:36 -0500, Fred Drake escreveu: On Mon, 14 Feb 2005 15:22:38 -0200, Leonardo Rochael Almeida [EMAIL PROTECTED] wrote: It's obvious that the container-class directive is being evaluated much earlier than the products directive. Without delving further into the code, it looks like the container-class directive has an error checking built right into the directive type that tries to import the assigned class, while the products direcive will only be made effective AFTER all ZConfig configuration has been processed... This is a known limitation. Should I bother with the collector entry or is it a known limitation no one is going to bother with? :-) You can avoid it by using the PYTHONPATH environment variable instead. And it must really be done in the environment, instead of with the path directive, as that is also evaluated too late in the process... Cheers, Leo -- Leonardo Rochael Almeida [EMAIL PROTECTED] Enfold Systems - http://www.enfolsystems.com/ ___ 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] ZConfig issue: products and container-class
On Mon, 14 Feb 2005 18:41:20 -0200, Leonardo Rochael Almeida [EMAIL PROTECTED] wrote: Should I bother with the collector entry or is it a known limitation no one is going to bother with? :-) It's not a bad idea to file a report in the collector. While I've no plan to change it myself, that's more a matter of being busy on other things. I think the right thing to do for the fix is to make dotted names get resolved later, but that requires changes in serveral places. And it must really be done in the environment, instead of with the path directive, as that is also evaluated too late in the process... That's right. The path and product configuration values are very similar. -Fred -- Fred L. Drake, Jr.fdrake at gmail.com Zope Corporation ___ 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 )