[Grok-dev] Re: big grok refactoring

Philipp von Weitershausen philipp at weitershausen.de
Wed Feb 7 10:12:18 EST 2007

Philipp von Weitershausen wrote:
> Jan-Wijbrand Kolman wrote:
>>> I spoke too fast, I just realized that grokking a package would also
>>> grok meta.py and this would re-grok the grokkers. It may not be harmful
>>> in operation as those grokkers would just be re-registered, but not 
>>> pretty.
>> (reviving an older discussion)
>> It's not pretty indeed: now that my application defines its own
>> grokker, this grokker is registered twice: first while grokking my
>> meta.py (triggered from my meta.zcml) and then again during 'normal'
>> grok time. As a result, the component I'm grokking is doing its work
>> twice.
>> I wonder if the solution is not rather simple (but then again, I might
>> not see its implications). Here's a proposal for a small patch. Would
>> this work?
> Looks like it.
>> Tests pass, my grokker is only registered once and thus my components 
>> are too.
> Cool. Can you also write a test in grok/tests/grokker that tests this? 
> Then I'll be happy to apply the patch.

Also, could you add a comment somewhere close to your modifications 
(perhaps in registerGrokker()) that explains why we're using a 
dictionary and the classes as keys... It might not be obvious to 
somebody reading the code at a later point.


http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5

More information about the Grok-dev mailing list