• File: cgitb_catcher.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/cgitb_catcher.cpython-37.pyc
  • Date Modified: 12/01/2019 7:09 PM
  • File size: 2.94 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

aN@sbdZddlZddlmZddlZddlmZGdddeZGdddeZ	edd	d
fddZ
dS)
z
WSGI middleware

Captures any exceptions and prints a pretty report.  See the `cgitb
documentation <http://python.org/doc/current/lib/module-cgitb.html>`_
for more.
N)StringIO)
convertersc@seZdZdS)	NoDefaultN)__name__
__module____qualname__rrD/opt/alt/python37/lib/python3.7/site-packages/paste/cgitb_catcher.pyrsrc@s8eZdZdedddfddZddZdd	Zd
dZdS)CgitbMiddlewareNhtmlcCsX||_|dkri}|tkr$|d}t|tr8t|}||_||_t	||_
||_dS)Ndebug)apprget
isinstance
basestringrasbooldisplaylogdirintcontextformat)selfrglobal_confrrrrrrr	__init__s



zCgitbMiddleware.__init__cCsLy|||}|||St}|ddg||||}|gSdS)Nz500 Internal Server Error)zcontent-typez	text/html)r
catching_itersysexc_infoexception_handler)renvironZstart_responseapp_iterrresponserrr	__call__)szCgitbMiddleware.__call__c
cs|std}y.x|D]
}|VqWt|dr8d}|Wnf|t|}|st|dry|Wn(|t|}|d|7}YnX|VYnXdS)NFcloseTz$<hr noshade>Error in .close():<br>%s)
StopIterationhasattrr#rrr)rr rZerror_on_closevr!Zclose_responserrr	r5s*


zCgitbMiddleware.catching_itercCs2t}tj||j|j|j|jd}|||S)N)filerrrr)rcgitbZHookrrrrgetvalue)rrrZ
dummy_filehookrrr	rLs
z!CgitbMiddleware.exception_handler)rrrrrr"rrrrrr	r
s
r
rrcCsHddlm}|tk	r||}d|kr4||d|d<t||||||dS)a
    Wraps the application in the ``cgitb`` (standard library)
    error catcher.
        
      display:
        If true (or debug is set in the global configuration)
        then the traceback will be displayed in the browser

      logdir:
        Writes logs of all errors in that directory

      context:
        Number of lines of context to show around each line of
        source code
    r)rr
)rrrrr)Zpaste.deploy.convertersrrr
)rrrrrrrrrr	make_cgitb_middlewareVsr+)__doc__r(	cStringIOrrZ
paste.utilrobjectrr
r+rrrr	<module>
sB