[Grok-dev] global_adapter method no longer gets adapts from factory annotation.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Mar 20 08:20:43 UTC 2012

On 3/15/12 13:55 , Jan-Carel Brand wrote:
> An obvious workaround has just dawned on me after sending this email.
> If global_adapter doesn't explicitly get the "adapts" value from the
> factory, I must provide it explicitly myself.
> So if I do the following, my adapters are registered and the validations
> work.
>> grok.global_adapter(ProcurementExplanationValidator,
>> adapts=ProcurementExplanationValidator.__component_adapts__)
>> grok.global_adapter(UniquenessValidator,
>> adapts=UniquenessValidator.__component_adapts__)
> It however *feels* wrong :D
> Is there a better, more elegant way of doing this? I'd still like to
> know how global_adapter is now supposed to get the "adapts" parameter it
> it's not explicitly passed in.
> Also, if the docstring of global_adapter says that "adapts" is gotten
> from the annotation, but it isn't, then I guess that line needs to be
> removed or the intention cleared up.

Hmm, not sure whether this change was intended. However, it might be
related to the changes to support the subscriptions feature...

I'll have a look.

Thanks for the elaborate post!

regards, jw

More information about the Grok-dev mailing list