wiki:NonPackagedKidTemplates
Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 1 (modified by robinbryce, 13 years ago) (diff)

--

Motivation

You want to deploy a site that uses kid templates in a manner that suites more traditional web deployment models. For example, you are working with web developers who are comfortable with html templating, possibly are familiar with kid, but are not python developers. Additionaly you may have very specific requirements with regard to how your site content is hosted, permissions, existing cacheing systems etc. For these reasons it is more convenient to support a site directory to which kid template files (.kid) can be uploaded to. The standard mechanisms for integrating kid templates with turbogears controlers look like this:

    class Root(controllers.RootControllers):
        @expose(template='yourpythonapp.templates.welcome')
        def index(self):
            import time
            return dict(now=time.time())

This uses the TurboKid? plugin to load templates from a python package that you must provide to wrap the templates. This example enables you to rewrite the above as:

    class Root(controllers.RootControllers):
        @expose(template='yourpythonapp/kid/welcome')
        def index(self):
            import time
            return dict(now=time.time())

And have welcome.kid loaded from the file system (possibly via custom caching machinery) without the need to bundle the template in a python package. It does this using a technique that is compatible with TurboKid? and the existing TurboGears template engine machinery.