[Grok-dev] skip grokking certain files

Martijn Faassen faassen at startifact.com
Wed Apr 29 11:23:59 EDT 2009


Wichert Akkerman wrote:
> Is there a way to prevent grokcore from grokking certain files? Files
> which may have side effects on import or are not intended to be loaded
> during Zope startup currently break the grokking process.

Martian has support for this; you can pass an exclude_filter to 
module_info_from_dotted_name.

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.

Regards,

Martijn




More information about the Grok-dev mailing list