Comment 1 for bug 713683

Revision history for this message
Uli Fouquet (uli-gnufix) wrote :

Hi Alex,

Thanks for the bug report! Unfortunately right now the latest megrok.login release (0.3) is yet not
ready for Grok 1.3. I'll try to release a fixed version soon, but please give a few days for that.

The more general question about what ZCML includes you need in a project depends and is too
complex to be answered in a few lines. But you should know that doing

  <include package='some.package' file='configure.zcml' />

means that a package 'some.package' is looked up in namespace during startup and in that
package the configuration machine looks for a file 'configure.zcml' which will be parsed to execute
registration of components like utilities, adapters, views, or similar things.

  <include package='some.package' />

is a shortcut of the above line.

Some packages also contain 'meta.zcml' files which define directives or tags for other ZCML
configuration files. These meta.zcml files have to be parsed before a respective directive is
used in a ZCML file.

Due to dependency changes in Grok 1.3 the directive mentioned in the traceback might not
be available in one of Groks base packages any more.

In your projects 'configure.zcml' you normally only include basic packages you need to register
the components/directives needed by your own code. One of these directives you normally
use is 'grok:grok' in a line like this:

  <grok:grok package='.' />

which means: 'grok' my package and register all the views, utilities, etc. defined in it.

To make this work (i.e. to teach the configuration machine, what 'grok:grok' means) you
normally can _prepend_ the lines:

   <include package="grok" />
   <includeDependencies package="." />

where the first one includes the 'grok' package's 'configure.zcml' and the second one
looks up and includes all respective ZCML files of packages you declared to depend on
in setup.py. This works recursive so that if packages in your setup.py depend on others
the latters are looked up too and so on (and everything in the right order).

The 'includeDependencies' directive is defined in the z3c.autoinclude package. Please
see http://pypi.python.org/pypi/z3c.autoinclude for more infos. This directive is really
handy and can help to keep your configure.zcml short and readable.