+
    Dfj                     J   R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht ^ RIHtHtHtHtHt Rt ! R R	]4      t ! R
 R4      t]P,                  ! RR]4      tR tR t ! R R]P4                  4      t ! R R]P4                  4      t ! R R]P4                  4      tR# )zH
I contain PythonScript, which is a very simple python script resource.
N)StringIO)	copyright)execfilenetworkString)_coerceToFilesystemEncoding)httpresourceserverstaticutilz<p>You forgot to assign to the variable "resource" in your script. For example:</p>
<pre>
# MyCoolWebApp.rpy

import mygreatresource

resource = mygreatresource.MyGreatResource()
</pre>
c                       ] tR t^tRtRtR# )AlreadyCachedz?
This exception is raised when a path has already been cached.
 N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       4/usr/lib/python3/dist-packages/twisted/web/script.pyr   r      s    r   r   c                   2   a  ] tR t^$t o R tR tR tRtV tR# )CacheScannerc                ,    Wn         W n        ^ V n        R# )    N)pathregistrydoCacheselfr   r   s   &&&r   __init__CacheScanner.__init__%   s    	 r   c                    V P                   P                  V P                  4      pVe   \        V4      hV P	                  4        R # N)r   getCachedPathr   r   recache)r   cs   & r   cacheCacheScanner.cache*   s3    MM''		2=""r   c                    ^V n         R# )   N)r   )r   s   &r   r%   CacheScanner.recache0   s	    r   )r   r   r   N)	r   r   r   r   r    r'   r%   r   __classdictcell____classdict__s   @r   r   r   $   s     
 r   r     Whoops! Internal Errorc           
     T   \        W4      pR\        RV 4      R\        RVRVP                  RVP                  /p \        WV4       TR,          pTP                  '       d   T\        Jd   TP                  Y4       T#   \         d   pTP                  ^ ,          u Rp?# Rp?ii ; i)z
I am a normal py file which must define a 'resource' global, which should
be an instance of (a subclass of) web.resource.Resource; it will be
renderred.
__file__ r   r   r'   r%   N)
r   r   noRsrcr'   r%   r   r   argsr   	cachePath)r   r   csglobacrsrcs   &&    r   ResourceScriptr;   7   s     
d	%B/D9FH2::DT" 
D	zzzd&(4&K  wwqzs   A? ?B'
B"B'"B'c                 *   ^ RI Hp R\        RV 4      R\        P                  ! RR\
        4      RV/p\        V 4      ;_uu_ 4       pVP                  W@4      pRRR4       \        XR	R
4      p\        WcV4       VR,          #   + '       g   i     L2; i)r   )ptl_compiler2   r3   r   r/   r0   r   Nz<source>exec)
quixoter=   r   r   _UnsafeErrorPagerpyNoResourceopencompile_templatecompileeval)r   r   r=   r8   fecodes   &&     r   ResourceTemplaterI   O   s    # 	/D9H--)=
 	HD 
dq((1 
1j&)DT
	 
s   BB	c                   6   a  ] tR t^at o RR ltR tR tRtV tR# )ResourceScriptWrapperNc                    \         P                  P                  V 4       Wn        T;'       g    \        P
                  ! 4       V n        R # r#   r   Resourcer    r   r
   Registryr   r   s   &&&r   r    ResourceScriptWrapper.__init__b   s1    ""4(	 55FOO$5r   c                d    \        V P                  V P                  4      pVP                  V4      # r#   )r;   r   r   render)r   requestress   && r   rR   ResourceScriptWrapper.renderg   s%    TYY6zz'""r   c                d    \        V P                  V P                  4      pVP                  W4      # r#   )r;   r   r   getChildWithDefault)r   r   rS   rT   s   &&& r   rW   )ResourceScriptWrapper.getChildWithDefaultk   s'    TYY6&&t55r   r   r   r#   )	r   r   r   r   r    rR   rW   r   r,   r-   s   @r   rK   rK   a   s     6
#6 6r   rK   c                   :   a  ] tR t^pt o RtRR ltR tR tRtV t	R# )ResourceScriptDirectorya  
L{ResourceScriptDirectory} is a resource which serves scripts from a
filesystem directory.  File children of a L{ResourceScriptDirectory} will
be served using L{ResourceScript}.  Directory children will be served using
another L{ResourceScriptDirectory}.

@ivar path: A C{str} giving the filesystem path in which children will be
    looked up.

@ivar registry: A L{static.Registry} instance which will be used to decide
    how to interpret scripts found as children of this resource.
Nc                    \         P                  P                  V 4       Wn        T;'       g    \        P
                  ! 4       V n        R # r#   rM   )r   pathnamer   s   &&&r   r     ResourceScriptDirectory.__init__~   s1    ""4(	 55FOO$5r   c                h   \         P                  P                  V P                  V4      p\         P                  P                  V4      '       d   \	        W0P
                  4      # \         P                  P                  V4      '       d   \        W0P
                  4      # \        P                  ! 4       # r#   )
osr   joinisdirr[   r   existsr;   r   _UnsafeNoResource)r   r   rS   fns   &&& r   getChild ResourceScriptDirectory.getChild   sm    WW\\$))T*77==*2}}==77>>"!"mm44))++r   c                J    \         P                  ! 4       P                  V4      # r#   )r   rd   rR   )r   rS   s   &&r   rR   ResourceScriptDirectory.render   s    ))+227;;r   rY   r#   )
r   r   r   r   r   r    rf   rR   r   r,   r-   s   @r   r[   r[   p   s     6
,< <r   r[   c                   4   a  ] tR t^t o RtRtR tR tRtV t	R# )PythonScriptz
I am an extremely simple dynamic resource; an embedded python script.

This will execute a file (usually of the extension '.epy') as Python code,
internal to the webserver.
Tc                    Wn         W n        R# )z#
Initialize me with a script name.
Nfilenamer   )r   rn   r   s   &&&r   r    PythonScript.__init__   s     ! r   c                   VP                  R\        R\        P                  ,          4      4       RVR\	        RV P
                  4      RV P                  /p \        V P
                  W"4       VP3                  4        \4        P6                  #   \         do   pTP                  ^8X  dT   TP                  \        P                  4       TP                  \        P                  ! R4      P!                  T4      4        Rp?LRp?i\"         dl    \%        4       p\&        P(                  ! TR	7       \*        P,                  ! TP/                  4       4      pTP1                  R
4      pTP                  T4        ELi ; i)a  
Render me to a web client.

Load my file, execute it in a special namespace (with 'request' and
'__file__' global vars) and finish the request.  Output to the web-page
will NOT be handled with print - standard output goes to the log - but
with request.write.
s   x-powered-byz
Twisted/%srS   r2   r3   r   zFile not found.N)fileutf8)	setHeaderr   r   versionr   rn   r   r   OSErrorerrnosetResponseCoder   	NOT_FOUNDwriter   rd   rR   BaseExceptionr   	traceback	print_excr   _PREgetvalueencodefinishr	   NOT_DONE_YET)r   rS   	namespacerG   iooutputs   &&    r   rR   PythonScript.render   s    	]<):K:K+KL	
 w3BF
	
	"T]]I9 	"""  	ww!|''7../@AHHQ  	"BR(YYr{{}-F]]6*FMM&!	"s&   B E;A$DE;A(E;:E;rm   N)
r   r   r   r   r   isLeafr    rR   r   r,   r-   s   @r   rk   rk      s       F! #  #r   rk   )r   r`   r{   r   r   twistedr   twisted.python.compatr   r   twisted.python.filepathr   twisted.webr   r   r	   r
   r   rA   	Exceptionr   r   r@   r4   r;   rI   rN   rK   r[   rk   r   r   r   <module>r      s   

 
    9 ? < <I    
	"	"3(@-	P0$6H-- 6<h// <@1#8$$ 1#r   