[zope2-tracker] [Bug 595060] [NEW] zope.formlib overrides Five browser pages

stephan_hofmockel dreagonfly at gmx.de
Wed Jun 16 07:48:17 EDT 2010


Public bug reported:

== Steps to reproduce ==
 * virtualenv --no-site-packages /tmp/bung_evn
 * source /tmp/bug_env/bin/activate
 * cd /tmp/bug_env/
 * easy_install Zope2==2.12.7
 * ./bin/mkzopeinstance -d bug_instance
 * cp BugProduct.tar.gz /tmp/bug_env/bug_instance/Products/
 * extract the BugProduct.tar.gz
 * /tmp/bug_env/bug_instance/bin/zopectl fg
 * Add a the bug product (its metat_ype is 'bug_type')
 * Acess the following page and you will get a KeyError for the key 'here'
   http://127.0.0.1:8080/BugClass/broken.html


It seems like the key 'here' is not added to the context, but the class
ViewPageTemplateFile (former name was ZopeTwoPageTemplateFile) in the package
Products/Five/browser/pagetemplatefile.py should fill the context with the
'here' key. But if you look at the traceback this class is not used.

For debugging I patched zope.configuration.xmlconfig.py a little bit
 def processxmlfile(file, context, testing=False):
     """Process a configuration file

     See examples in tests/text_xmlconfig.py
     """
+    print file
     src = InputSource(getattr(file, 'name', '<string>'))
     src.setByteStream(file)

Here is a reduces output ( each line means a loaded file by
zope.configuration)

'/tmp/bug_env/bug_instance/etc/site.zcml'
'/tmp/bug_env/lib/python2.6/site-packages/Zope2-2.12.7-py2.6-linux-i686.egg/Products/Five/configure.zcml
.....
'/tmp/bug_env/lib/python2.6/site-packages/Zope2-2.12.7-py2.6-linux-i686.egg/Products/Five/browser/meta.zcml'
...
'/tmp/bug_env/lib/python2.6/site-packages/Zope2-2.12.7-py2.6-linux-i686.egg/Products/Five/form/configure.zcml'
'/tmp/bug_env/lib/python2.6/site-packages/five.formlib-1.0.3-py2.6.egg/five/formlib/configure.zcml'
'/tmp/bug_env/lib/python2.6/site-packages/zope.app.form-4.0.2-py2.6.egg/zope/app/form/browser/configure.zcml'
'/tmp/bug_env/lib/python2.6/site-packages/zope.formlib-4.0.3-py2.6.egg/zope/formlib/configure.zcml'
'/tmp/bug_env/lib/python2.6/site-packages/zope.browserpage-3.12.2-py2.6.egg/zope/browserpage/meta.zcml'

As you see the Five.browser.meta.zcml is loaded which registers the Five handlers for the zcml directives like <browser:page, ....
BUT while loading the zope.formlib the zope.browserpage.meta.zcml is loaded, which registers other handlers for the zcml directives like <browser:page

I'm not a zope.configuration expert, but it seems for me that the Five
handlers are overridden by the zope.browserpage ones.

I know, for my particular KeyError I can replace the 'here' with 'context' inside the page template.
However I would like to share my findings, because it seems like a bigger problem.

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
zope.formlib overrides Five browser pages 
https://bugs.launchpad.net/bugs/595060
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list