File: //usr/lib/python3/dist-packages/twisted/web/__pycache__/script.cpython-310.pyc
o
�bG � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZm Z ddl
mZ ddlm
Z
mZmZmZmZ dZG d d
� d
e�ZG dd� d�Ze�d
de�Zdd� Zdd� ZG dd� dej�ZG dd� dej�ZG dd� dej�ZdS )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 @ 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 )�path�registry�doCache��selfr 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 �cs�glob�ac�rsrcr r r �ResourceScript7 s"