[Grok-dev] Re: z3c.widget.tiny, resourceLibrary and automatic load of resources

Tres Seaver tseaver at palladion.com
Tue Jan 15 15:50:18 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martijn Faassen wrote:
> Hey,
> 
> Dirceu Pereira Tiegs wrote:
> [snip]
>> Thanks for the info. Here is my final configure.zcml:
>>
>> <configure xmlns="http://namespaces.zope.org/zope"
>>           xmlns:grok="http://namespaces.zope.org/grok">
>>  <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="." />
>> </configure>
>>
>> Why all these packages?
> [snip]
>> 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 
> trickier.

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. -->
 <dwim-zcml />

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.
Tres.
- --
===================================================================
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

iD8DBQFHjRyK+gerLs4ltQ4RAgOVAJ0Rc5yNkMZD/4IPW3afRC8/ngh8VQCeJ9t9
F5Scs8SX5TPWXVwHfSvpukM=
=5SRW
-----END PGP SIGNATURE-----



More information about the Grok-dev mailing list