ó
ži‚Nc           @   sR   d  d l  Z  d  d l Z d  d l m Z d  d l m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   TemplateLookup(   t   Templatet   TGPluginc           B   s>   e  Z d  Z d d d d „ Z d d „ Z d e d d „ Z RS(   s&   TurboGears compatible Template Plugin.t   makc         C   sÚ   | |  _  | |  _ | s! i  } n  i  } xS | j ƒ  D]E \ } } | j d ƒ r` | | | d <q4 | d k r4 | | | <q4 q4 Wt |   |  _ i  |  _ x> t j t	 j
 ƒ d D]& } | | k r¬ | | |  j | <q¬ q¬ Wd  S(   Ns   mako.i   t   directoriest   filesystem_checkst   module_directoryi    (   R   R   R   (   t   extra_vars_funct	   extensiont	   iteritemst
   startswithR    t   lookupt   tmpl_optionst   inspectt
   getargspecR   t   __init__(   t   selfR   t   optionsR   t   lookup_optionst   kt   vt   kw(    (    s7   /usr/lib/python2.7/dist-packages/mako/ext/turbogears.pyR      s    				c         C   s\   | d k	 r t | |  j  Sd | k rL d | j d d ƒ d |  j } n  |  j j | ƒ S(   s(   Loads a template from a file or a stringt   /t   .N(   t   NoneR   R   t   replaceR   R   t   get_template(   R   t   templatenamet   template_string(    (    s7   /usr/lib/python2.7/dist-packages/mako/ext/turbogears.pyt   load_template$   s
    $t   htmlc         C   sM   t  | t ƒ r! |  j | ƒ } n  |  j r@ | j |  j ƒ  ƒ n  | j |   S(   N(   t
   isinstancet
   basestringR   R   t   updatet   render(   R   t   infot   formatt   fragmentt   template(    (    s7   /usr/lib/python2.7/dist-packages/mako/ext/turbogears.pyR"   /   s
    	N(   t   __name__t
   __module__t   __doc__R   R   R   t   FalseR"   (    (    (    s7   /usr/lib/python2.7/dist-packages/mako/ext/turbogears.pyR      s   (   t   reR   t   mako.lookupR    t   mako.templateR   t   objectR   (    (    (    s7   /usr/lib/python2.7/dist-packages/mako/ext/turbogears.pyt   <module>   s   