[Grok-dev] grok directive for only grokking during development mode

Martijn Faassen faassen at startifact.com
Tue Feb 5 14:28:18 EST 2008


Hi there,

I think it would be useful to have a directive that can be put on a 
component so it only gets grokked during development mode, not in 
production mode. Something like this:

class MyView(grok.View):
    grok.devel()

'MyView' would only be grokked and thus only registered in development 
mode, not in production mode. This requires us figuring out what 
development-mode and production-mode currently mean in Zope and how to 
detect it during the grokking process...

Or perhaps we should generalize this to the tagging story we already 
discussed quite a while ago:

class MyView(grok.View):
    grok.tag('devel')

the 'grok.tag' directive would receive one or more tags. Tags are then 
used to determine what gets grokked or not, perhaps like this:

<grok:grok package="." include_tags="a b" exclude_tags="c d" />

It'd be nice to be able to spell out the include_tags and exclude_tags 
in Python somehow, so that we don't end up writing a lot of ZCML in the 
end. :)

Some tags could be given special meaning, like 'devel', which means 
"don't include during production mode". Anyway, a bit of design to work out.

What do people think? Ideas? Suggestions?

Someone volunteering for its implementation? :)

Regards,

Martijn



More information about the Grok-dev mailing list