[Grok-dev] generic directoryresource in grokcore.view

Kevin Teague kevin at bud.ca
Fri Oct 17 17:23:01 EDT 2008

To answer my own question:

Should DirectoryResources be used to share page templates between

No (at least in my use case). DirectoryResources are request
dependent, and also publish those resources directly on the web.
Neither of which my template sharing use case cares about, I just want
"extension" packages to use a template defined in a parent package ...
so a simple function in the main package:

def edit_form_template():
    """Return a Page Template suitable for usage in GUM Form Views"""
    return grok.PageTemplateFile('gum_edit_form.pt')

And then the extension packages can use this template with:

import gum
class CustomEditForm(grok.EditForm):
    template = gum.edit_form_template()

Solves my problem with a minimum amount of fuss :_)

(and I'm still using a DirectoryResource to share js, css, images
between packages)

More information about the Grok-dev mailing list