[Grok-dev] Viewlets template inheritance broken if in another package?

Souheil CHELFOUH trollfot at gmail.com
Sun Oct 18 17:37:14 EDT 2009


yes, in your base form, you can add a :

template = grok.PageTemplate(...)

that's the quick and dirty solution.
It's now officially unofficially supported :)


2009/10/18 Mikko Ohtamaa_ <mikko+fckingnabbleloginisbroken at redinnovation.com>:
>
> Hi,
>
> I am using five.grok to cook up some viewlets.
>
> I'd like to make viewlets reusable, so that other *packages* should subclass
> them.
>
> foo.package1
> foo.package1/templates/head.pt
>
> class HeadViewlet(grok.Viewlet):
>
>   grok.template("head")
>
> bar.package2
> (no templates)
>
> from foo.package1 import HeadViewlet
>
> class HeadViewlet2(HeadViewlet):
>    pass
>
> However, looks like Grok doesn't liket the idea.
>
> - Grok assumes templates are under "templates" which in my case happens to
> be Python package of the parent class. Grok does not look templates from
> there, but assumes bar.package2/templates which does not exist.
>
> - I cannot specify absolute templatedir (only relative paths allowed) with
> grok.templatedir() to force to use parent class template path
>
> Is there any other solution than just copying the same template around to
> every package?
> --
> View this message in context: http://www.nabble.com/Viewlets-template-inheritance-broken-if-in-another-package--tp25944725p25944725.html
> Sent from the Grok mailing list archive at Nabble.com.
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list