XylotrechusZ
�
˒�g] � �. � d Z ddlZddlZddlZdd�Zd� Zy)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 dt j |� � |gz }t |� rwddj |� z }||k7 r=t ||� r1|j s#|j j t
||f|� S |S t |� dk( rn|g|dd t |� r�w|j s#|j j t
||fd � S y # t $ r Y ��w xY 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 �C/opt/hc_python/lib/python3.12/site-packages/mako/ext/autohandler.pyr r ! s2 � �
�^�^�F��O�O�1�1�M��#�#� ��$�$�k�=�$�%G�H�H� �Z�Z�
�I�$5�$5�m�$D�
E���
N�F�
�f�+��S�X�X�f�%�%���=� �\�&�$�%?��+�+��(�(�3�3� �-��6��� � ���v�;�!����f��r�s�� �f�+� �#�#�� � �+�+�
�-��.��
�
� ��- � �� �s �D% �% D1�0D1c � � t j dd|� }| j D ]) }t j j |dz |z � s�) y y)Nz^/� r TF)r �sub�directories�osr �exists)r r �psub�ds r r r @ sD � �
�6�6�%��T�"�D�
�
�
��
�7�7�>�>�!�c�'�D�.�)�� � � )r )�__doc__r r r r r � r$ r �<module>r'