�
Ϫ�fK � �F � d dl mZ G d� dej � Zd� Zd� Zy)� )�resourcec �$ � e Zd Zd� Zd� Zd� Zd� Zy)�RewriterResourcec �p � t j j | � || _ t |� | _ y �N)r �Resource�__init__�list�rewriteRules)�self�origr s �5/usr/lib/python3/dist-packages/twisted/web/rewrite.pyr zRewriterResource.__init__ s* � ����"�"�4�(���
� ��.��� c �6 � | j D ]
} ||� � y r )r )r �request�rewriteRules r �_rewritezRewriterResource._rewrite s � ��,�,� !�K��� � !r c �4 � |j j d|� |j j � | j |� |j j d� }|j j |� | j j ||� S )Nr )�postpath�insert�prepath�popr �appendr �getChildWithDefault)r �pathr s r �getChildzRewriterResource.getChild ss � �������4�(��������
�
�g�����#�#�A�&�������t�$��}�}�0�0��w�?�?r c �Z � | j |� | j j |� S r )r r �render)r r s r r zRewriterResource.render s# � ��
�
�g���}�}�#�#�G�,�,r N)�__name__�
__module__�__qualname__r r r r � r r r r s � �/�
!�@�-r r c �� � | j rh| j d d d dk( rRd| j d dd g| j d d ddj | j | j z � z | _ y y y )Nr � �~�users�/)r �joinr r )r s r �tildeToUsersr) sy � ����G�,�,�Q�/���3�s�:� '��)9�)9�!�)<�Q�R�)@�A�����!���S�X�X�g�o�o��8H�8H�&H�I�I��� ;�r c �Z � �� �j d� �� j d� � � �fd�}|S )a�
I am not a very good aliaser. But I'm the best I can be. If I'm
aliasing to a Resource that generates links, and it uses any parts
of request.prepath to do so, the links will not be relative to the
aliased path, but rather to the aliased-to path. That I can't
alias static.File directory listings that nicely. However, I can
still be useful, as many resources will play nice.
r' |