[Grok-dev] Nesting packages in src

Darryl Cousins darryl at darrylcousins.net.nz
Fri Mar 9 22:28:13 EST 2007


Hi,

It doesn't seem to be possible to nest packages in src folder of a
grokproject generated package, eg:

+ namespacepackage (tfws)/
	- __init__.py
	+ subpackage (site)/
		- __init__.py
		- app.py
		- configure.zcml
		- app_templates/
		- static

app.py::

  import grok
  class App(grok.Application, grok.Model):
	pass

  class Index(grok.View):
	grok.template('index')

and an index.pt template in app_templates.

# parts/instance/bin/runzope

GrokError: View <class 'tfws.site.app.Index'> has no associated template
or 'render' method.

Is this by design? Without the view the App object can be added in the
grok admin ui. Or if all code is the top (tfws) package the code works.

This is unfortunate I believe because a complex app would then end up
with a overloaded top package if subpackages cannot be used.

Likewise how would a number of grokker packages be grouped into a single
namespace?

Thoughts?

Meantime I'll keep everything in the single top package (as with
grokstar) and keep playing.

Regards,
Darryl



More information about the Grok-dev mailing list