zope.formlib overrides Five browser pages

Bug #595060 reported by stephan_hofmockel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Low
Unassigned

Bug Description

== 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.

Revision history for this message
stephan_hofmockel (dreagonfly) wrote :
Revision history for this message
Hanno Schlichting (hannosch) wrote :

Please follow the instructions to install Zope2 via virtualenv at http://docs.zope.org/zope2/releases/2.12/INSTALL.html. Especially the bit where you absolutely need to use an index.

You are running a combination of unsupported libraries. Zope 2.12.7 does not include nor work with zope.browserpage. zope.app.form 4.x is not supported by any Zope 2 release.

Changed in zope2:
importance: Undecided → Low
status: New → Invalid
Revision history for this message
stephan_hofmockel (dreagonfly) wrote :

Sorry for disturbance, it was the wrong installation mechanism. I forgot to point to the versions.cfg.
All problems described above did not happen with the correct versions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.