• File: prints.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyc
  • Date Modified: 08/01/2016 7:39 PM
  • File size: 5.42 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

aNc@sdZddlmZddlZddlZddlmZddlmZddlm	Z	ddl
Z
eadgZ
defd	YZdefd
YZdS(s
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.

i(tStringION(t
threadedprint(twsgilib(tresponsetPrintDebugMiddlewaretTeeFilecBseZdZdZRS(cCs
||_dS(N(tfiles(tselfR((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyt__init__"scCsCt|trt|}nx|jD]}|j|q(WdS(N(t
isinstancetunicodetstrRtwrite(Rtvtfile((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyR%s(t__name__t
__module__RR(((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyR s	cBsleZdZdZdeeedZdZe	j
de	jZe	j
de	je	j
ZdZRS(sL
    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.
    s<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>cCs_||_||_t|tr@ddlm}||}n||_||_d|_	dS(Ni(tasbool(
tapptforce_content_typeR	t
basestringtpaste.deploy.convertersRtprint_wsgi_errorstreplace_stdouttNonet_threaded_print_stdout(RRtglobal_confRRRR((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyRDs				cs|jdr|j||Sts8|jtjk	ratatjd|j	tj|_ngfd}||d<t
}|g}||d<|jr|j|dnt
|}tj|ztj||j\}}}	|dkr-d}d
g}||||	s-d
}	q-ntj|d}
sf|jr|
sf|
jd	r||kr|dj|jn||||	gStj|d|j|	|j}	||||	gSWdtjXdS(Ns
paste.testingtleave_stdoutcsjddS(N(tappendR((tremoved(sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pytremove_printdebug^sspaste.remove_printdebugspaste.printdebug_listenersswsgi.errorss500 Server ErrorsContent-types	text/htmlsAn error occurredscontent-typescontent-length(sContent-types	text/html(tgetRt_threadedprint_installedRtsyststdouttTrueRtinstallRRRRRtregisterRtintercept_outputRRtheader_valueRt
startswithRtgetvaluet
remove_headertadd_logt
deregister(Rtenvirontstart_responseRtloggedt	listenerstreplacement_stdouttstatustheaderstbodytcontent_type((RsC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyt__call__QsP
		
	
	



s<body[^>]*>s'<pre\s*[^>]*id="paste-debug-prints".*?>cCs|s
|Stj|}|jdd}|jdd}|jj|}|sw|j|}|jj|}n|s||S||j |||jSdS(Ns
s<br>s  s&nbsp; (tcgitescapetreplacet_explicit_retsearchtlog_templatet_body_retend(Rthtmltlogttexttmatch((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyR+s
N(RRt__doc__R<RtFalseR#RR6tretcompiletIR=tSR:R+(((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyR,s	2	(RCt	cStringIORRER7t
paste.utilRtpasteRRR!RDR t__all__tobjectRR(((sC/opt/alt/python27/lib/python2.7/site-packages/paste/debug/prints.pyt<module>s