o ¯bKã@s2ddlmZGdd„dejƒZdd„Zdd„ZdS) é)Úresourcec@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚRewriterResourcecGs tj |¡||_t|ƒ|_dS©N)rÚResourceÚ__init__ÚlistÚ rewriteRules)ÚselfÚorigr©r ú5/usr/lib/python3/dist-packages/twisted/web/rewrite.pyr s zRewriterResource.__init__cCs|jD]}||ƒqdSr)r)r ÚrequestÚ rewriteRuler r r Ú_rewrites  ÿzRewriterResource._rewritecCsH|j d|¡|j ¡| |¡|j d¡}|j |¡|j ||¡S)Nr)ÚpostpathÚinsertÚprepathÚpoprÚappendrÚgetChildWithDefault)r Úpathr r r r ÚgetChilds     zRewriterResource.getChildcCs| |¡|j |¡Sr)rrÚrender)r r r r r rs  zRewriterResource.renderN)Ú__name__Ú __module__Ú __qualname__rrrrr r r r rs  rcCs`|jr,|jddd…dkr.d|jddd…g|jdd…<dd |j|j¡|_dSdSdS)Nréú~Úusersú/)rÚjoinrr)r r r r Ú tildeToUserss þr!cs&ˆ d¡‰ˆ d¡‰‡‡fdd„}|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. rcsR|jdtˆƒ…ˆkr'|jtˆƒd…}ˆ||_dd |j|j¡|_dSdS)Nr)rÚlenr rr)r Úafter©Ú aliasPathÚ sourcePathr r Úrewriter1s  ýzalias..rewriter)Úsplit)r%r&r'r r$r Úalias%s r)N)Ú twisted.webrrrr!r)r r r r Ús