Ñò
úõIc @ sH d Z d d k Z d d k Z d d k l Z d e f d „ ƒ YZ d S( sq
Default engine plugin for TGWidgets.
Based on BuffetString which is Copyright (c) 2006 Christian Wyglendowski
iÿÿÿÿN( t resource_filenamet ToscaWidgetsTemplatePluginc B s; e Z d Z d d d „ Z d d „ Z d e d d „ Z RS( s .htmlc C s- | | _ | o
| | _ n
t ƒ | _ d S( s extra_vars_func == optional callable() that returns a dict
config == optional dict() of configuration settings
N( t get_extra_varst configt dict( t selft extra_vars_funcR ( ( s9 /usr/lib/python2.6/site-packages/tw/core/engine_plugin.pyt __init__ s
c C s˜ | d j o t i | ƒ S| i d ƒ } | d j o2 | | } | | d | i } t | | ƒ } n t | ƒ } t i | i ƒ ƒ } | i ƒ | S( sî
template_name == dotted.path.to.template (without .ext)
template_string == string containing the template
The dotted notation is present because many template engines
allow templates to be compiled down to Python modules. TurboGears
uses that feature to its adavantage, and for ease of integration
the python.templating.engines plugin format requires the path to
the template to be supplied as a dotted.path.to.template regardless
of whether is is a module or not.
In the case of string.Template templates, they are just simple text
files, so we deal with the dotted notation and translate it into a
standard file path to open the text file.
t .i i N( t Nonet stringt Templatet rfindt extensionR t opent readt close( R t
template_namet template_stringt dividert packaget basenamet
template_filet template_obj( ( s9 /usr/lib/python2.6/site-packages/tw/core/engine_plugin.pyt
load_template s
t htmlc C s4 t | i ƒ o | i | i ƒ ƒ n | i | S( s
info == dict() of variables to stick into the template namespace
format == output format if applicable
fragment == special rules about rendering part of a page
template == compiled template as returned by `load_template`
( t callableR t updatet safe_substitute( R t infot formatt fragmentt template( ( s9 /usr/lib/python2.6/site-packages/tw/core/engine_plugin.pyt render9 s N( t __name__t
__module__R
R R R t FalseR! ( ( ( s9 /usr/lib/python2.6/site-packages/tw/core/engine_plugin.pyR s
( t __doc__R
t ost
pkg_resourcesR t objectR ( ( ( s9 /usr/lib/python2.6/site-packages/tw/core/engine_plugin.pyt