[Grok-dev] Grokking Order
Paul Wilson
paulalexwilson at gmail.com
Fri Jan 2 18:16:30 EST 2009
2009/1/2 Paul Wilson <paulalexwilson at gmail.com>:
> To recap - I have a GlobalUtility that will be serving as a container
> for custom grokked classes. I've got grokkers for these custom classes
> using component.getUtility(IMyInterface) to get my GlobalUtility so
> that they can be placed inside it, but I'm receiving a
> ComponentLookupError. However, an instance of my GlobalUtility is
> apparently being created. It seems like Grok is waiting for all
> components to be grokked before enabling the component architecture.
Solved.
The ``GlobalUtility`` grokker was calling config.action from
zope.configuration which was deferring the actual registration of my
components so that it could apply a discriminator to check for
configuration conflicts. So, I modified my grokker to do the same:
gave it a discriminator of ``None`` (cannot conflict with anything),
and a high-valued ordering. It now runs as expected:
config.action(
discriminator=None,
callable=globally_register_component,
args=(class_, name, category),
order=9999,
)
Thanks,
Paul
More information about the Grok-dev
mailing list