[Grok-dev] Re: final sprint report - please review my branch!
Philipp von Weitershausen
philipp at weitershausen.de
Wed Apr 9 09:52:55 EDT 2008
Martijn Faassen wrote:
> Philipp von Weitershausen wrote:
> [snip]
>> It is as long as you're fine with actually creating new classes. If
>> you'd want to make existing classes implicit contexts, you're out of
>> luck.
>
> I'm not sure whether this use case is very common, but it might be one.
> It'd be interesting to come up with some real world scenarios where this
> requirement comes up.
Well, I imagine that the Plone folks have their own ideas, but I
personally wouldn't want to invent yet another base class for Plone
content and just work off the existing Archetypes or CMF ones. That way
the new grok-based stuff works with *existing* classes, which is pretty
important IMHO.
>> I like the IGrokContext idea. It's just as simple as subclassing
>> 'Context' (which we can still leave around). Sounds like a win-win
>> solution.
>
> True, I hadn't thought of the use case you mentioned, but using an
> interface would fix this.
>
> Anyway, I'm still don't think we should be in a rush to get this fixed,
> but grokking based on interface should be a feature for the longer term
> todo list in Martian, and it shouldn't be too hard to implement as far
> as I can determine.
It's really just a two-line change, one in the Context base class (to
say that it implements IGrokContext) and one in the grokker so that it
doesn't do isinstance() but IGrokContext.implementedBy().
More information about the Grok-dev
mailing list