ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ aNc@sdZddlZddlZddlZddlZddlmZddlZddlZddl Z ddl Z ddl m Z m Z mZddlmZddlmZddlmZddlmZdd lmZdd lmZddlZd Zd Zed ZdZdZdZdZeje e j Z!dZ"de#fdYZ$de#fdYZ%de j&fdYZ'dZ(dZ)dZ*dZ+dZ,ddZ.dS(s Exception-catching middleware that allows interactive debugging. This middleware catches all unexpected exceptions. A normal traceback, like produced by ``paste.exceptions.errormiddleware.ErrorMiddleware`` is given, plus controls to see local variables and evaluate expressions in a local context. This can only be used in single-process environments, because subsequent requests must go back to the same process that the exception originally occurred in. Threaded or non-concurrent environments both work. This shouldn't be used in production in any way. That would just be silly. If calling from an XMLHttpRequest call, if the GET variable ``_`` is given then it will make the response more compact (and less Javascripty), since if you use innerHTML it'll kill your browser. You can look for the header X-Debug-URL in your 500 responses if you want to see the full debuggable traceback. Also, this URL is printed to ``wsgi.errors``, so you can open it up in another browser window. iN(tStringIO(terrormiddlewaret formattert collector(twsgilib(t urlparser(thttpexceptions(tregistry(trequest(tresponseicCs&|dkrdStjt|dS(s; Escape HTML characters, plus translate None to '' tiN(tNonetcgitescapetstr(tv((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt html_quote/s cCsn|rt|}n|jdd}tjdt|}tjdt|}tjdt|}d|S(s Quote a value for HTML, preserving whitespace (translating newlines to ``
`` and multiple spaces to use `` ``). If ``quote`` is true, then the value will be HTML quoted first. s s
s()( +)s(\n)( +)s^()( +)s%s(Rtreplacetretsubt _repl_nbsp(Rtquote((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytpreserve_whitespace7scCsKt|jddkrdS|jddt|jdddS(Niis t (tlentgroup(tmatch((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRFscsfd}|S(s\ A simple middleware that catches errors and turns them into simple tracebacks. csky||SWnSt}tjd||ddgtj|j}dt|gSXdS(Ntfiles500 Server Errors content-types text/htmls

Error

%s
(s content-types text/html(Rt tracebackt print_exctsystexc_infotgetvalueR(tenvirontstart_responsetouttres(t application(sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytsimplecatcher_appPs   ((R%R&((R%sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt simplecatcherKs cCs d}|S(s= Turns a function or method into a WSGI application. csfd}t|_|S(Ncstdkr6d}d}dgn\}}gfd}tj|}t|}|||S(Niiiicstj|dt}tjidd6dd6}||d<||d<|j}|jd}|||j|gS(Ntinclude_get_varss text/htmls content-types200 OKtstatusR!theaders(Rtparse_formvarstTrueR t HeaderDicttmixedtpopt headeritems(R!R"tformR*R$R)(targstfunc(sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyR%ms      (RRtmake_middlewareR'(R2R!R"R%tapp(R3(R2sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytwsgiapp_wrappercs     (R,texposed(R3R6((R3sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt decoratorbs ((R8((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytwsgiapp^s csfd}|S(s A decorator (meant to be used under ``wsgiapp()``) that resolves the ``debugcount`` variable to a ``DebugInfo`` object (or gives an error if it can't be found). csyd|krtdn|jd}yt|}Wntk r\tdnX||jkrtd|n|j|}|d||SWn,tk r}d|ddThere was an error: %s(t ValueErrorR/tintt debug_infosR(tselfR1R:R;te(R3(sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytdebug_info_replacements"    ((R3RA((R3sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytget_debug_infoscCs0d|kr|dStj|d<}|SdS(s? Return the unique debug count for the current request spaste.evalexception.debug_countN(t debug_countertnext(R!RD((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytget_debug_counts t EvalExceptioncBseZd d dZdZdZdZee_dZ ee _dZ ee _dZ ee _dZ dZ eee Z d ZeeeZd Zd ZRS( cCsU||_i|_|dkrH|dkr3d}qH|jdd}n||_dS(Nt_t xmlhttp_key(R%R>R tgetRH(R?R%t global_confRH((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt__init__s     cCs`|d std||d<|jddjdrL|j||S|j||SdS(Nswsgi.multiprocesssIThe EvalException middleware is not usable in a multi-process environmentspaste.evalexceptiont PATH_INFOR s/_debug/(tAssertionErrorRIt startswithtdebugtrespond(R?R!R"((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt__call__s   cCstj|dksttj|}t||d}|sttjd|tj|f}|j ||St|dt stj d|}|j ||S|||S(Nt_debugs%r not found when parsing %rR7s%r not allowed( Rt path_info_popRMtgetattrR Rt HTTPNotFoundRt construct_urltwsgi_applicationtFalset HTTPForbidden(R?R!R"t next_parttmethodtexc((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyROs cCs7tjtjjtjjtd}|||S(s? Static path where images and other files live tmedia(RtStaticURLParsertostpathtjointdirnamet__file__(R?R!R"R5((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyR]s$cCs7tjtjjtjjtd}|||S(s2 Static path where MochiKit lives tmochikit(RR^R_R`RaRbRc(R?R!R"R5((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRds$cCsa|ddgg}|jj}|jdg|D]}|j^q<}t|gS(s[ Returns a JSON-format summary of all the cached exception reports s200 OKs Content-types text/x-jsoncSst|j|jS(N(tcmptcreated(tatb((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytR (s Content-types text/x-json(R>tvaluestsorttjsontrepr(R?R!R"tdatatitemstitem((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytsummarys cCs\ttj|}||jkr?|ddgd|gS|j|}|j||S(s, View old exception reports s500 Server Errors Content-types text/htmlsHTraceback by id %s does not exist (maybe the server has been restarted?)(s Content-types text/html(R=RRSR>RW(R?R!R"tidR;((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytviews  cCs |d|S(Ns/_debug/view/%s((R?R!t base_pathtcount((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt make_view_urlscKsm|jt|}|jj}|rVtjj|jt|}tjj nd}t |||S(Ns No local vars( tframeR=ttb_frametf_localsRtrestorertrestoration_begintcountert make_tabletrestoration_endt input_form(R?ttbidR;tkwRwtvarst local_vars((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt show_frames  c Ks|jsdS|jd}|jt|}|jj}|jj}tj||}t j j |j |j |} t j jtj|} dt| dtt| fS(NR s sD>>> %s
%sR(tstriptrstripRwR=RxRyt f_globalst evalcontextt EvalContextRRzR{R|t exec_exprR~Rtstr2htmlRRX( R?RR;tinputRRwRt glob_varstcontexttoutputt input_html((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyt exec_inputs    csC|jdr|j|Stj|dtdt}t|dRMRHRtparse_querystringtdictRt format_htmltcontent(R?R!R"RtRt__traceback_supplement__tapp_itert return_iterRtexpectedRutview_uriR*texc_dataR;tget_varsthtml((R"RsO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRP"sX             c Csht}|jrBtj|}t|j|jrBt}qBntj||ddtdtd|S(Ns wsgi.errorsRt debug_modetsimple_html_error( RXRHRRRRIR,Rthandle_exception(R?RR!RR((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytexception_handler_s   N(t__name__t __module__R RKRQROR]R,R7RdRqRsRvRR9RBRRPR(((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRFs&            =RcBs>eZdZdZdZdZdZdZRS(c Cs||_||_||_||_||_tj|_|\|_|_|_ d}g|_ d}|j } xd| dk rt dks|t kr| j jjdrPn|j j| | j} |d7}quWdS(Niit__exception_formatter__(R|RRtR!RttimeRftexc_typet exc_valuettbtframesR tlimitRxRyRIRttb_next( R?R|RRRtR!RRtnR((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRKms"       ' cCsWi|jd6tjdtj|jd6|jd6t|jd6t|jd6S(s2Return the JSON-able representation of this objectturis%cRftcreated_timestamptexception_typet exception(RRtstrftimetgmtimeRfRRR(R?((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRls   cCsDx=|jD]}t||kr |Sq Wtd||jfdS(NsNo frame by id %s found from %r(RRrR<(R?RRw((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRws cCs|ddg|jS(Ns200 OKs content-types text/html(s content-types text/html(R(R?R!R"((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRWscCsvt|j|j|j}tjtj}||j7}t|j }t i|pYdd6|d6|d6}|gS(NR t repost_buttont head_htmltbody( tformat_eval_htmlRRtR|Rt error_cssthide_display_jsteval_javascripttmake_repost_buttonR!terror_template(R?RRRtpage((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRs  cCs$|jd}d||||jfS(Ns/_debugs (RtR|(R?Rt((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRs (RRRKRlRwRWRR(((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRks     tEvalHTMLFormattercBseZdZdZRS(cKs,tt|j|||_||_dS(N(tsuperRRKRtR|(R?RtR|R((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRKs cCs0tjj|||}|d|j|jfS(Ns        (Rt HTMLFormattertformat_source_lineRRt(R?tfilenameRwtline((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRs  (RRRKR(((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRs c CsNt|tr(|j}|jng}d}x|D]\}}|d7}t}ytj||Wn!tk r}|d|IJnXt|j}t |dkr|}|d }|d7}|d|d7}nt j |}|drd}nd }|j d |t|t |d tfq;Wd d j|S(Niis Error: %sidsj...s%%sis class="even"s class="odd"s[%s%sRs%s
s (RRRoRkRtpprintt ExceptionRR RRtmake_wrappableRRRXRa( RotrowstitnametvalueR#R@t orig_valuetattr((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyR}s6          c Cstd|d|dt}|j|}td|d|dtdtdt}|j|}tj|dt}|j|j|j|jkrd|}nd}d||tj |fS( NRtR|Rtshow_hidden_framesRs
%s
R s %s %s
( RRXtformat_collected_dataR,Rt format_textt filter_framesRR R ( RRtR|tshort_formattertshort_ertlong_formattertlong_erttext_ertfull_traceback_html((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyRs$    cCs/tj|}|ddkr'd|SdSdS(NtREQUEST_METHODtGETsB
(RRVR (R!turl((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyR s cCsdi|d6S(Ns~

R((RR;((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pyR*ssE Server Error %(head_html)s %(repost_button)s %(body)s cCs1|dkr!|jdd}nt|d|S(s Wraps the application in an interactive debugger. This debugger is a major security hole, and should only be used during development. xmlhttp_key is a string that, if present in QUERY_STRING, indicates that the request is an XMLHttp request, and the Javascript/interactive debugger should not be returned. (If you try to put the debugger somewhere with innerHTML, you will often crash the browser) RHRGN(R RIRF(R5RJRH((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytmake_eval_exceptionSs (/t__doc__RR_R Rt cStringIORRt itertoolsRRtpaste.exceptionsRRRtpasteRRRRRR RRRR,RRR'R9RBRuR=RCREtobjectRFRRRR}RRRRR R(((sO/opt/alt/python27/lib/python2.7/site-packages/paste/evalexception/middleware.pytsF              "  E ! *  '