grouping directives do not accomodate certain attributes in directive schemas
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Won't Fix
|
Undecided
|
Unassigned | ||
zope.configuration |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Adding an attribute to a grouping directive's schema that is directly accessed by `zope.configura
Attached is a sample traceback from 'transcript.log' that occurred when I attempted to use the 'factory' attribute for one of my custom grouping directives.
Note that the last line in the traceback:
ZopeXMLConf
... refers to the first subdirective of the directive that contains the factory attribute. The subdirective is also registered as a grouping directive.
I believe that the intended 'factory' attribute is the 'factory' method of `zope.configura
I've read that complex directives will eventually be deprecated in favor of grouping directives. If that's true, then this change will need to be made for complex directives that currently have a `factory` or `action` attribute.
Changed in zope3: | |
status: | New → Won't Fix |
Also, if the grouping directive you create doesn't subclass `zope.configura tion.config. GroupingContext Decorator` and/or doesn't have similar '__getattr__' functionality (and still satisfies the interface contract of `zope.configura tion.interfaces .IGroupingConte xt`), then Zope will terminate with an AttributeError message complaining about the lack of a 'factory' attribute.
Instead of attempting to find the needed methods on its 'context' member, perhaps the various stack item class instances should find the objects with the methods they need by searching up the tree until an object that implements `zope.configura tion.interfaces .IConfiguration Context` is found. Something like:
def __getConfigurat ionContext( self): ontext. implementedBy( context) :
context = self.context
while not IConfigurationC
context = context.context
return context
... and replacing `self.context` with `self._ _getConfigurati onContext( )` (where appropriate) should work (I haven't tested it), and would still allow grouping directives to contain attributes like 'action' and 'factory'.