Also, if the grouping directive you create doesn't subclass `zope.configuration.config.GroupingContextDecorator` and/or doesn't have similar '__getattr__' functionality (and still satisfies the interface contract of `zope.configuration.interfaces.IGroupingContext`), 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.configuration.interfaces.IConfigurationContext` is found. Something like:
def __getConfigurationContext(self):
context = self.context
while not IConfigurationContext.implementedBy(context):
context = context.context
return context
... and replacing `self.context` with `self.__getConfigurationContext()` (where appropriate) should work (I haven't tested it), and would still allow grouping directives to contain attributes like 'action' and 'factory'.
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'.