[Grok-dev] Static dir with grok.PageTemplateFile

Alex Leach albl500 at york.ac.uk
Mon May 14 11:08:25 UTC 2012


Hi Christian,

Thanks for that. I believe I am indeed using grokcore.view 2.7.

Soo, if I understand the CHANGES.txt correctly, I have to add a 
__static_name__ attribute to all forms that use the grok.PageTemplateFile 
directive, pointing to the relevant library.

Thanks, that works actually! In case anyone else comes across this, my form 
declaration now looks like:-


from app_name import resource

class AddSQLDatabaseForm(grok.AddForm):
	grok.context(Server)
	grok.implements(ISQLDatabase)
	grok.name('addSQLdatabase')
	form_fields = grok.AutoFields(ISQLDatabase)
	template = grok.PageTemplateFile("edit-form.pt")
	__static_name__ = resource.library

Cheers,
Alex


On Monday 14 May 2012 10:55:28 Christian Klinger wrote:
| Hi Alex,
| 
| we recently worked on the bavarian sprint on that topic. Which version
| of grokcore.view do you use?
| 
|  From the CHANGES.TXT in grokcore.view 2.7:
| 
| Fix how the static resource are found. Instead of using as name the
| package name where the component is defined, using as name the package
| where the template for the component is defined, or the base component.
| This is done by setting an attribute __static_name__ on the component
| that specify which resource directory should be used. This fix missing
| resources when you extend the component and don't redefined the template.
| 
| HTH
| 
| Christian

-- 
Alex Leach BSc. MRes.
Department of Biology
University of York
York YO10 5DD
United Kingdom
www: http://bioltfws1.york.ac.uk/~albl500
EMAIL DISCLAIMER: http://www.york.ac.uk/docs/disclaimer/email.htm


More information about the Grok-dev mailing list