%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/paste/debug/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/paste/debug/__pycache__/prints.cpython-37.pyc

B

a�N��@szdZddlmZddlZddlZddlmZddlmZddlm	Z	ddl
Z
dadgZGd	d
�d
e
�ZGdd�de
�ZdS)a
Middleware that displays everything that is printed inline in
application pages.

Anything printed during the request will get captured and included on
the page.  It will usually be included as a floating element in the
top right hand corner of the page.  If you want to override this
you can include a tag in your template where it will be placed::

  <pre id="paste-debug-prints"></pre>

You might want to include ``style="white-space: normal"``, as all the
whitespace will be quoted, and this allows the text to wrap if
necessary.

�)�StringION)�
threadedprint)�wsgilib)�responseF�PrintDebugMiddlewarec@seZdZdd�Zdd�ZdS)�TeeFilecCs
||_dS)N)�files)�selfr�r
�C/opt/alt/python37/lib/python3.7/site-packages/paste/debug/prints.py�__init__"szTeeFile.__init__cCs0t|t�rt|�}x|jD]}|�|�qWdS)N)�
isinstance�unicode�strr�write)r	�v�filer
r
rr%s
z
TeeFile.writeN)�__name__�
__module__�__qualname__rrr
r
r
rr src@sPeZdZdZdZddd�Zdd	�Ze�d
ej	�Z
e�dej	ej�Zdd
�Z
dS)raL
    This middleware captures all the printed statements, and inlines
    them in HTML pages, so that you can see all the (debug-intended)
    print statements in the page itself.

    There are two keys added to the environment to control this:
    ``environ['paste.printdebug_listeners']`` is a list of functions
    that will be called everytime something is printed.

    ``environ['paste.remove_printdebug']`` is a function that, if
    called, will disable printing of output for that request.

    If you have ``replace_stdout=True`` then stdout is replaced, not
    captured.
    z�<pre style="width: 40%%; border: 2px solid #000; white-space: normal; background-color: #ffd; color: #000; float: right;"><b style="border-bottom: 1px solid #000">Log messages</b><br>%s</pre>NFTcCs@||_||_t|t�r*ddlm}||�}||_||_d|_dS)Nr)�asbool)	�app�force_content_typer
�
basestringZpaste.deploy.convertersr�print_wsgi_errors�replace_stdout�_threaded_print_stdout)r	rZglobal_confrrrrr
r
rrDs
zPrintDebugMiddleware.__init__cs\|�d�r|�||�Str&|jtjk	rBdatj|jd�tj|_g��fdd�}||d<t	�}|g}||d<|j
r�|�|d�t|�}t�
|�z�t�||j�\}}}	|dkr�d	}d
g}|||�|	s�d}	t�|d�}
�s�|j�s"|
r�|
�d
��s"||k�r|d�|���|||�|	gSt�|d�|�|	|���}	|||�|	gSt��XdS)Nz
paste.testingT)Zleave_stdoutcs��d�dS)N)�appendr
)�removedr
r�remove_printdebug^sz8PrintDebugMiddleware.__call__.<locals>.remove_printdebugzpaste.remove_printdebugzpaste.printdebug_listenerszwsgi.errorsz500 Server Error)zContent-typez	text/htmlzAn error occurredzcontent-typez	text/htmlzcontent-length)�getr�_threadedprint_installedr�sys�stdoutr�installrrrrr�registerrZintercept_outputrZheader_valuer�
startswithr�getvalueZ
remove_header�add_logZ
deregister)r	�environZstart_responserZloggedZ	listenersZreplacement_stdout�status�headers�body�content_typer
)rr�__call__QsP





zPrintDebugMiddleware.__call__z<body[^>]*>z'<pre\s*[^>]*id="paste-debug-prints".*?>cCs�|s|St�|�}|�dd�}|�dd�}|j�|�}|sP|j|}|j�|�}|s\||S|d|���|||��d�SdS)N�
z<br>z  z&nbsp; )�cgi�escape�replace�_explicit_re�search�log_template�_body_re�end)r	�html�log�text�matchr
r
rr(�s

zPrintDebugMiddleware.add_log)NFTF)rrr�__doc__r5rr.�re�compile�Ir6�Sr3r(r
r
r
rr,s
2)r<�	cStringIOrr=r0Z
paste.utilr�pasterrr"r!�__all__�objectrrr
r
r
r�<module>s

Zerion Mini Shell 1.0