ϪfHdZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z mZmZmZmZdZGd d eZGd d Zej,d deZdZdZGddej4ZGddej4ZGddej4Zy)zH I contain PythonScript, which is a very simple python script resource. N)StringIO) copyright)execfile networkString)_coerceToFilesystemEncoding)httpresourceserverstaticutilz

You forgot to assign to the variable "resource" in your script. For example:

# MyCoolWebApp.rpy

import mygreatresource

resource = mygreatresource.MyGreatResource()
ceZdZdZy) AlreadyCachedzG This exception is raised when a path has already been cached. N)__name__ __module__ __qualname____doc__4/usr/lib/python3/dist-packages/twisted/web/script.pyrrsrrceZdZdZdZdZy) CacheScannerc.||_||_d|_y)Nr)pathregistrydoCacheselfrrs r__init__zCacheScanner.__init__%s    rc|jj|j}| t||j yN)r getCachedPathrrrecache)rcs rcachezCacheScanner.cache*s3 MM ' ' 2 =" " rcd|_y)N)r)rs rr"zCacheScanner.recache0s  rN)rrrrr$r"rrrrr$s  rrWhoops! Internal Errorc.t||}td|t||j|jd} t ||||d}|jr|tur|j|||S#t $r}|jdcYd}~Sd}~wwxYw)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 rr$r"rNr ) rrnoRsrcr$r"rrargsr cachePath)rrcsglobacrsrcs rResourceScriptr37s dH %B/D9::  DtT"  D zzd&(4& K wwqzs A22 B;B BBcddlm}td|tjddt |d}t |5}|j||}dddtdd}t||||d S#1swY(xYw) Nr) ptl_compiler*r'r()r+r rzexecr ) quixoter5rr _UnsafeErrorPage rpyNoResourceopencompile_templatecompileeval)rrr5r0fecodes rResourceTemplaterAOs#0D9-- )=   D d2q  ( (D 12 1j& )DtT   22s A55A>c eZdZddZdZdZy)ResourceScriptWrapperNctjj|||_|xst j |_yr r Resourcerrr Registryrrs rrzResourceScriptWrapper.__init__bs0""4(  5FOO$5 rcdt|j|j}|j|Sr )r3rrrender)rrequestress rrIzResourceScriptWrapper.rendergs%TYY 6zz'""rcft|j|j}|j||Sr )r3rrgetChildWithDefault)rrrJrKs rrMz)ResourceScriptWrapper.getChildWithDefaultks)TYY 6&&tW55rr )rrrrrIrMrrrrCrCas6 #6rrCc$eZdZdZddZdZdZy)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. Nctjj|||_|xst j |_yr rE)rpathnamers rrz ResourceScriptDirectory.__init__~s0""4(  5FOO$5 rcRtjj|j|}tjj|rt ||j Stjj |rt||j StjSr ) osrjoinisdirrOrexistsr3r _UnsafeNoResource)rrrJfns rgetChildz ResourceScriptDirectory.getChildsk WW\\$))T * 77== *2t}}= = 77>>" !"dmm4 4))++rcHtjj|Sr )r rWrI)rrJs rrIzResourceScriptDirectory.renders))+227;;rr )rrrrrrYrIrrrrOrOps 6 ,r{s   9?<< I   # " "3(@- P0$ 6H-- 6