global_adapter method no longer gets "adapts" from factory annotation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grok |
Fix Committed
|
High
|
Jan Wijbrand Kolman |
Bug Description
-------
I'm creating this ticket after the mailing list discussion on this topic:
https:/
Most of the text that follows come straight from my first email to the mailing list.
-------
I'm developing with Plone/dexterity
grokcore.component 1.9 and trying to see if I can use a newer version
instead.
With grokcore.component > 1.9 I however get a
ConfigurationCl
Here is the error's traceback: http://
The two clashing adapters are two validators that I am registering via
grok.global_
So, looking inside grokcore/
that there are some changes made between 1.9 and 2.0 that cause this
breakage.
If you look at the registration of my adapters, I don't provide "adapts"
or "provides" kw args to global_adapter. The docstring of method
global_adapter itself says:
> If omitted, this information is deduced from the annotation on the
> factory.
In grokcore.component < 1.9, this happened explicitly:
> if adapts is None:
> adapts = getattr(factory, '__component_
But since 2.0 that code is now gone. What happens now is that my two
global adapters are registered against adapts=None and provides=None.
And of course, since they don't have names, they registration clashes.
Looking at the SVN log, I see that Martijn introduced the mentioned
change in global_adapter with the following explanation:
> r104104 | faassen | 2009-09-15 18:30:24 +0200 (Tue, 15 Sep 2009) | 6
> <snip>
>
> Upgrade to use the new Martian 0.12. This allowed us to
> significantly simplify the way the context directive worked. It
> also made us realize it's bad form to use directives in the
> implementation of a directive - directive.
> be used during Grok time, never during import time.
To be honest, I don't see know how the above should result in the changes in
global_adapter.
My grokcore versions:
> '/home/
> '/home/
> '/home/
> '/home/
> '/home/
the tests were very cleverly hiding the issue indeed. It has been fixed.