
    g]                     .    d Z ddlZddlZddlZddZd Zy)a  adds autohandler functionality to Mako templates.

requires that the TemplateLookup class is used with templates.

usage::

    <%!
        from mako.ext.autohandler import autohandler
    %>
    <%inherit file="${autohandler(template, context)}"/>


or with custom autohandler filename::

    <%!
        from mako.ext.autohandler import autohandler
    %>
    <%inherit file="${autohandler(template, context, name='somefilename')}"/>

    Nc                 h   |j                   }| j                  j                  }|j                  s	 |j                  t
        ||f   S t        j                  dt        j                  |            |gz   }t        |      rwddj                  |      z   }||k7  r=t        ||      r1|j                  s#|j                  j                  t
        ||f|      S |S t        |      dk(  rn|g|dd  t        |      rw|j                  s#|j                  j                  t
        ||fd       S y # t        $ r Y w xY w)Nz([^/]+)/   )lookupmodule_template_urifilesystem_checks
_uri_cacheautohandlerKeyErrorrefindall	posixpathdirnamelenjoin_file_exists
setdefault)templatecontextnamer   r	   tokenspaths          S/var/www/html/AdoubleTech/venv/lib/python3.12/site-packages/mako/ext/autohandler.pyr   r   !   s2   ^^FOO11M##	$$k=$%GHH ZZ
I$5$5m$DENF
f+SXXf%%= \&$%?++((33 -6  v;!frs f+ ##  ++-.
 	
 -  		s   D% %	D10D1c                     t        j                  dd|      }| j                  D ])  }t        j                  j                  |dz   |z         s) y y)Nz^/ r   TF)r   subdirectoriesosr   exists)r   r   psubds       r   r   r   @   sI    66%T"D 77>>!c'D.)     )r   )__doc__r    r   r   r   r    r$   r   <module>r'      s   * 
  	>r$   