[Grok-dev] Re: z3c.widget.tiny,
resourceLibrary and automatic load of resources
tseaver at palladion.com
Tue Jan 15 15:50:18 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Martijn Faassen wrote:
> Dirceu Pereira Tiegs wrote:
>> Thanks for the info. Here is my final configure.zcml:
>> <configure xmlns="http://namespaces.zope.org/zope"
>> <include package="zope.app.component" file="meta.zcml" />
>> <include package="zope.app.pagetemplate" file="meta.zcml" />
>> <include package="zc.resourcelibrary" file="meta.zcml" />
>> <include package="zc.resourcelibrary" />
>> <include package="z3c.widget.tiny" />
>> <include package="grok" />
>> <grok:grok package="." />
>> Why all these packages?
>> Is there a better way to do this?
> Not really, but there *should* be.
> Quoting myself from elsewhere in this thread:
> > One of the issues I'd like to solve at some state is automatic loading
> > of configure.zcml and meta.zcml when you include a package in your
> > setup.py dependencies.
> Once this is set up, we can stop repeating ourselves. Right now we
> indicated inter-package dependency structure-related information in a
> number of places:
> * Python import statements: from other import foo
> * ZCML include statements: <include package="other" /> (also meta.zcml
> in some cases)
> * setup.py package install_requires
> * possibly buildout.cfg [versions] section to lock the versions into place
> The ZCML include statement case looks like it's easiest to get rid of.
> After that we can see whether more magic is possible, but that'll be
Just for the record, I'm opposed to automagically registering ZCML (and
therefore policy) from a package, just because I happen to import
something from the package. If you do this, it should be in terms of an
explicit directive (e.g., in the genereated site.zcml) with a big XML
comment explaining why the directive is there:
<!-- Enabling this directive causes implicit loading of ZCML
from "dependency" packages; you may need to disable it
if you find that one or more of the policies in those files
don't suit. -->
Now, if you are shipping an application which sets up an "instance" of
some sort, you should of course feel free to wire up whatever ZCML is
needed by that application in the context of that instance. Just don't
assume that the presence on sys.path of a package containing ZCML
implies that we should load it.
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the Grok-dev