ó aòNc@sƒdZddlZddlmZddlZddlmZdefd„ƒYZdefd„ƒYZ edd d d „Z dS( s¦ WSGI middleware Captures any exceptions and prints a pretty report. See the `cgitb documentation `_ for more. iÿÿÿÿN(tStringIO(t converterst NoDefaultcBseZRS((t__name__t __module__(((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyRstCgitbMiddlewarecBs;eZdedddd„Zd„Zd„Zd„ZRS(ithtmlcCs‹||_|dkri}n|tkr<|jdƒ}nt|tƒr]tj|ƒ}n||_||_ t |ƒ|_ ||_ dS(Ntdebug( tapptNoneRtgett isinstancet basestringRtasbooltdisplaytlogdirtinttcontexttformat(tselfRt global_confRRRR((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyt__init__s      cCsiy&|j||ƒ}|j||ƒSWn<tjƒ}|ddg|ƒ|j||ƒ}|gSXdS(Ns500 Internal Server Errors content-types text/html(s content-types text/html(Rt catching_itertsystexc_infotexception_handler(Rtenvirontstart_responsetapp_iterRtresponse((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyt__call__)s ccsÓ|st‚nt}y<x|D] }|VqWt|dƒrPt}|jƒnWn{|jtjƒ|ƒ}| rÆt|dƒrÆy|jƒWqÆ|jtjƒ|ƒ}|d|7}qÆXn|VnXdS(Ntcloses$
Error in .close():
%s(t StopIterationtFalsethasattrtTrueRRRR(RRRterror_on_closetvRtclose_response((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyR5s*   c CsStƒ}tjd|d|jd|jd|jd|jƒ}||Œ|jƒS(NtfileRRRR(RtcgitbtHookRRRRtgetvalue(RRRt dummy_filethook((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyRLs      N(RRR RRRRR(((sD/opt/alt/python27/lib/python2.7/site-packages/paste/cgitb_catcher.pyRs iRc Csvddlm}|tk r+||ƒ}nd|krN||dƒ|d s  B