o bG @ s d Z ddlZddlZddlmZ ddlmZ ddlmZm Z ddl mZ ddlm Z mZmZmZmZ dZG d d d eZG dd dZed deZdd Zdd ZG dd dejZG dd dejZG dd dejZdS )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()c @ s e Zd ZdZdS ) AlreadyCachedzG This exception is raised when a path has already been cached. N)__name__ __module____qualname____doc__ r r 4/usr/lib/python3/dist-packages/twisted/web/script.pyr s r c @ s$ e Zd Zdd Zdd Zdd ZdS )CacheScannerc C s || _ || _d| _d S )Nr )pathregistrydoCacheselfr r r r r __init__% s zCacheScanner.__init__c C s* | j | j}|d urt|| d S N)r getCachedPathr r recache)r cr r r cache* s zCacheScanner.cachec C s d| _ d S )N )r )r r r r r 0 s zCacheScanner.recacheN)r r r r r r r r r r r $ s r Whoops! Internal Errorc C s t | |}td| t||j|jd}zt| || W n ty1 } z|jd W Y d}~S d}~ww |d }|jrC|turC| | | |S )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 r Nr ) r r noRsrcr r r r argsr cachePath)r r csglobacrsrcr r r ResourceScript7 s" r+ c C s| ddl m} td| tddt|d}t| }||| }W d n1 s)w Y t|dd}t ||| |d S ) Nr )ptl_compiler" r r! )r# r r z