No Error Msg re Invalid ZCML Attribute
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/
setup(
File "/usr/share/
zope.
File "/usr/share/
context = xmlconfig.
File "/usr/share/
context.
File "/usr/share/
callable(*args, **kw)
File "/usr/share/
method(*args, **kwargs)
File "/usr/share/
raise TypeError(iface, IInterface)
zope.configurat
in:
File "/var/hostings/
>
/>
/>
-
Changed in zope3: | |
status: | New → Confirmed |
Changed in zope3: | |
status: | Confirmed → Won't Fix |
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."