No Error Msg re Invalid ZCML Attribute

Bug #98257 reported by Bug Importer
0
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Medium
Unassigned
zope.configuration
Won't Fix
Undecided
Unassigned

Bug Description

When an unsupport attribute is used with a ZCML tag, you get a traceback but no indication of what the problem is. In the example below, removing the "layer=" attribute fixes the problem, but to find that out you have to iteratively remove each attribute one-by-one.

BTW, the "layer=" is supported in the books and, in the code there seems to be a movement away from string layer names to interfaces. However, the deprecation warning only keys off the layer name "default", and is bypassed if you specify a customer layer name. I think that then confuses the code.

---- cut here ----
-bash-2.05b$ bin/runzope
Traceback (most recent call last):
  File "bin/runzope", line 48, in ?
    run()
  File "bin/runzope", line 44, in run
    main(["-C", CONFIG_FILE] + sys.argv[1:])
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/app/server/main.py", line 58, in main
    setup(load_options(args))
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/app/server/main.py", line 169, in setup
    zope.app.appsetup.config(options.site_definition)
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/app/appsetup/appsetup.py", line 52, in config
    context = xmlconfig.file(file, execute=execute)
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/configuration/xmlconfig.py", line 557, in file
    context.execute_actions()
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/configuration/config.py", line 622, in execute_actions
    callable(*args, **kw)
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/app/component/metaconfigure.py", line 42, in handler
    method(*args, **kwargs)
  File "/usr/share/zope-3.1.0-py2.4/lib/python/zope/component/site.py", line 171, in provideAdapter
    raise TypeError(iface, IInterface)
zope.configuration.config.ConfigurationExecutionError: exceptions.TypeError: (<module 'webaccountant' from '/var/hostings/98tau0417/taupro.com/zope3/lib/python/webaccountant/__init__.pyc'>, <InterfaceClass zope.interface.interfaces.IInterface>)
  in:
  File "/var/hostings/98tau0417/taupro.com/zope3/lib/python/webaccountant/ventures/browser/configure.zcml", line 166.6-184.6
        <browser:view
            name="+"
            for="webaccountant.ventures.interfaces.IVentureSet"
            class="zope.app.container.browser.adding.Adding"
            layer="webaccountant"
            menu="zmi_actions" title="Add"
            permission="zope.ManageContent"
            >

            <browser:page
                name="index.html"
                attribute="index"
                />

            <browser:page
                name="action.html"
                attribute="action"
                />
        </browser:view>
-

Tags: core issue
Revision history for this message
Philipp von Weitershausen (philikon) wrote :

The 'layer' attribute to <browser:view /> is actually perfectly legal, so your assumption that the error message doesn't display the correct thing is not quite correct.

If you look at the traceback carefully, you will see that the ZCML machinery complains that the "webaccountant" *module* doesn't provide IInterface. This indicates that ZCML is confusing the "webaccountant" module for your layer. If I'm correct, there's only one way that can happen: you forgot to define the layer via <browser:layer />.

zope.app.component.fields.LayerField should be made to check if the layer object it retrieves by resolving a dottedname actually provides IIinterface. If that isn't the case, it should present nice error message, for example: "The XXX object of type XXX is not an interface."

Changed in zope3:
status: New → Confirmed
Tres Seaver (tseaver)
Changed in zope3:
status: Confirmed → Won't Fix
Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in zope.configuration:
status: New → Won't Fix
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.