On Dec 5, 1:32 pm, "Alberto Valverde" <[EMAIL PROTECTED]> wrote:
> > Would this be easier if I switch to Genshi?  I'm not opposed to
> > upgrading anyway since that is the future.Yes, it is easier with Genshi 
> > thanks to it's support for XInclude
> (http://tinyurl.com/ya4j2k).
>
> You can even use "py" directives to generate the include tags :)

Yes, I had figured that out and was about to post my results.  The
XInclude header does indeed make life easy on the template side.  The
only thing I had to worry about is that turbogears doesn't seem to have
a way to specify more template paths.  I did that manually.

Here is a simple controller that I can mount from any application.

class CommonController:
        """
        Including site simply has to let controller know the path to
the site templates
        and the name of the master template file.
        """
        def __init__(self,template_dir,master_path):
                self.t_dir=resource_filename(__name__,'templates')
                self.t_loader=TemplateLoader([self.t_dir,template_dir])
                self.master_path=master_path
        @expose()
        def login(self,**kw):
                t=self.t_loader.load('login.html') # this template is in the 
common
template dir
                return t.generate(master_path=self.master_path).render()


Thoughts?
Can you think of a better way to accomplish this?

-Dennis


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to