[Grok-dev] Re: How do I track down a
zope.configuration.config.ConfigurationConflictError
Sebastian Ware
sebastian at urbantalk.se
Thu Feb 21 17:22:00 EST 2008
Many, many thanks for your help Philipp. It seems that I have solved
my problem, but I am still a bit confused as to why it worked before.
21 feb 2008 kl. 20.56 skrev Philipp von Weitershausen:
> Sebastian Ware wrote:
>> In the traceback bellow. How do I figure out what the conflict is?
>
> By reading the traceback carefully ;). I admit, though, that the
> traceback is mostly geared towards ZCML currently and may be a bit
> misleading.
>
> There's actually a very straight-forward way of equipping the
> configuration machinery with the right information so that
> tracebacks look meaningful. We could use this so that the traceback
> would quote our Python code instead of some meaningless ZCML. This,
> however, will involve changing either Martian or the grokkers to
> annotate the configuration context with the information accordingly,
> which isn't always easy because I'm not sure if you can get this
> info from classes, for example (you *can* get it from function
> objects through their code objects). This is why I chickened out of
> it during the initial move towards configuration action, and left it
> for another day.
>
This would be very useful indeed!!!
>> Traceback (most recent call last):
> ...
>> zope.configuration.config.ConfigurationConflictError: Conflicting
>> configuration actions
>
> This line is the interesting one. It contains the discriminator by
> which conflicts are detected. It looks as if you're trying to
> register two views ('adapter' discriminator) for the ProtonCMS class
> called 'add_table'.
That made the offending code easy to find. :)
>
>
>> For: ('adapter', (<class 'prestatics.app.ProtonCMS'>,
>> <InterfaceClass
>> zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
>> <InterfaceClass zope.interface.Interface>, 'add_table')
>> File "/Users/jhsware/groksandbox/Prestatics/src/prestatics/
>> configure.zcml", line 4.2-4.27
>> <grok:grok package="." />
>> File "/Users/jhsware/groksandbox/Prestatics/src/prestatics/
>> configure.zcml", line 4.2-4.27
>> <grok:grok package="." />
>
> Here's another conflict. It looks like you're registering two
> adapters for IProtonWorkflowItem.
This one is a bit more confusing. The offending code seems to be:
class WorkflowState(grok.Adapter, workflow.WorkflowState):
grok.context(IProtonWorkflowItem)
class WorkflowInfo(grok.Adapter, workflow.WorkflowInfo):
grok.context(IProtonWorkflowItem)
After a lot of experimenting, and eventually looking in the tests of
grok.adapter, I changed the code to this:
class WorkflowState(grok.Adapter, workflow.WorkflowState):
grok.context(IProtonWorkflowItem)
grok.provides(interfaces.IWorkflowState)
class WorkflowInfo(grok.Adapter, workflow.WorkflowInfo):
grok.context(IProtonWorkflowItem)
grok.provides(interfaces.IWorkflowInfo)
Now it seems to work. Was the grok.provides part done "automagically"
in earlier versions of Grok? I am still confused that it worked before.
mvh Sebastian
>
>
>> For: ('adapter', <InterfaceClass
>> prestatics.interfaces.IProtonWorkflowItem>, None, '')
>> File "/Users/jhsware/groksandbox/Prestatics/src/prestatics/
>> configure.zcml", line 4.2-4.27
>> <grok:grok package="." />
>> File "/Users/jhsware/groksandbox/Prestatics/src/prestatics/
>> configure.zcml", line 4.2-4.27
>> <grok:grok package="." />
>
More information about the Grok-dev
mailing list