[Grok-dev] skip grokking certain files
Paul Wilson
paulalexwilson at gmail.com
Fri Aug 7 09:51:08 EDT 2009
2009/4/29 Martijn Faassen <faassen at startifact.com>:
> Unfortunately grokcore.component does not yet have support for
> configuring this further in its zcml.py. It configures the
> exclude_filter by default to skip tests but you cannot add anything else
> to it. I could imagine you'd like an extra exclude_modules which lists
> modules you don't want to grok.
>
> So if you're interested you could look into expanding the 'grok' ZCML
> directive so you can optionally pass a list of files to exclude along
> with it. We could then release a new version of grokcore.component with
> this functionality soon.
>
> One limitation I see right now in the exclude_filter is that it seems
> difficult to actually skip a file *only* in a single package and not in
> any sub packages.
Okay, how would this work then; I fancy having a look. You'd need to
specify a list of modules to exclude from the grokking process. This
could be either an exhaustive list:
<grok:grok package="foo">
<grok:exclude_module module="me" />
<grok:exclude_module module="grok" />
...
</ grok:grok>
or maybe something more general:
<grok:grok package="bar">
<grok:exclude_pattern expr="^f?tests$" />
</ grok:grok>
or both:
<grok:grok package="xyz">
<grok:exclude_module module="me" />
<grok:exclude_module module="grok" />
<grok:exclude_pattern expr="^f?tests$" />
</ grok:grok>
or perhaps more simply:
<grok:grok package="baz" exclude_modules="some;delim;separated;list" />
or something I haven't thought of?
Secondly, we have already mentioned issue of wanting to specify
specific modules (rather than any module/package matching a name). My
immediate idea was that if the package was preceeded by a dot, then it
was relative to the package root:
<grok:grok package="faz" exclude_modules=".tests.grokkers" />
Although this may introduce complexities regarding the recursive
nature of the scanning algorithm.
Paul
More information about the Grok-dev
mailing list