TypeError in Five fiveconfigure.py

Bug #181956 reported by Darryl Dixon on 2008-01-11
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Undecided
Unassigned

Bug Description

In Five/fiveconfigure.py with Zope 2.9.8, when there is a zcml error in a Product that Five tries to initialise, this error is raised:

2008-01-11T18:56:23 ERROR Zope Couldn't install Five
Traceback (most recent call last):
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/OFS/Application.py", line 783, in install_product
    initmethod(context)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/__init__.py", line 29, in initialize
    zcml.load_site()
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/zcml.py", line 41, in load_site
    _context = xmlconfig.file(file)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 558, in file
    include(context, name, package)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 494, in include
    processxmlfile(f, context)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 349, in processxmlfile
    parser.parse(src)
  File "/home/dixond/zope/app/python-2.4.4/lib/python2.4/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/home/dixond/zope/app/python-2.4.4/lib/python2.4/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/home/dixond/zope/app/python-2.4.4/lib/python2.4/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/home/dixond/zope/app/python-2.4.4/lib/python2.4/xml/sax/expatreader.py", line 348, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 328, in endElementNS
    self.context.end()
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/config.py", line 544, in end
    self.stack.pop().finish()
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/config.py", line 692, in finish
    actions = self.handler(context, **args)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/fiveconfigure.py", line 88, in loadProducts
    handleBrokenProduct(product)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/fiveconfigure.py", line 66, in handleBrokenProduct
    logger.error('Could not import Product %s' % product.__name__, error=True)
  File "/home/dixond/zope/app/python-2.4.4/lib/python2.4/logging/__init__.py", line 999, in error
    apply(self._log, (ERROR, msg, args), kwargs)
ZopeXMLConfigurationError: File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/skel/site.zcml", line 13.2-13.23
    TypeError: _log() got an unexpected keyword argument 'error'

This is because the original zLOG logger was changed for the python logger library, and the zLOG keyword argument 'error=True' was left behind in the handleBrokenProduct() function. This has been corrected in HEAD, but in persists in the latest 2.9.x Zope releases.

Darryl Dixon (esrever-otua) wrote :

Further, once this is fixed, Five still fails to initialise (presumably because of the invalid zcml directive in the Product it is trying to initialise):

2008-01-11T20:16:20 ERROR Five Could not import Product Products.MyContent <---- This line now logs correctly with the error above manually fixed
------
2008-01-11T20:16:20 ERROR Zope Couldn't install Five
Traceback (most recent call last):
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/OFS/Application.py", line 783, in install_product
    initmethod(context)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/__init__.py", line 29, in initialize
    zcml.load_site()
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/Products/Five/zcml.py", line 41, in load_site
    _context = xmlconfig.file(file)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 558, in file
    include(context, name, package)
  File "/home/dixond/zope/app/zope-2.9.8/lib/python/zope/configuration/xmlconfig.py", line 496, in include
    assert _context.stack[-1].context is context
AssertionError

When the configure.zcml in the 'MyContent' Product is corrected, the AssertionError above goes away and Five initialises properly.

Hanno Schlichting (hannosch) wrote :

The specific error doesn't happen anymore in recent and maintained Zope2 releases.

affects: zopeproject → zope2
Changed in zope2:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers