[Grok-dev] module_info, template, grokcore.view

Sylvain Viollon sylvain at infrae.com
Mon Mar 26 11:56:13 UTC 2012


   I still use the view.static behavior, with grokcore.view. I don't know if you do guys.

   I am often annoyed by one point however. I mostly (95% or the time) use the view.static in a template. However if I inherit my view in an another package, I keep my template, but the view.static is different, and I loose access to the resources.

   For me, static is linked to the template. I think it should be 'kept'.

   For the moment static is an adapter that is queried with the name of the package that contains the view. I propose to change this to the name of the package that contains the template.

   I poposed to add an attribute __static_name__ (or something else) on the view, that would be initialized by the template registry (in templatereg, associate_template) with the value of the module_info.package_dotted_name if there is an association.

   In the view base class, the static adapter would be looked using this name if set, or will default to the one contained in the view's module_info.

   What do you think of this ?



PS: Yes that may break applications, but the result should be more useful, I think.

Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands

More information about the Grok-dev mailing list