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

Mikko Ohtamaa_ mikko+fckingnabbleloginisbroken at redinnovation.com
Sun Oct 18 04:09:33 EDT 2009


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.



More information about the Grok-dev mailing list