ÿØÿà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Áß_ÿÙ bNc@sdZddlmZmZmZddlmZmZmZddlm Z m Z m Z m Z ddlm Z mZmZddlmZddlZddlmZddlZdd lmZddlZd d d d ddddddddddddddddgZd efdYZd efdYZdefd YZdefd!YZdd"Z d#efd$YZ!de"d%Z#d&efd'YZ$d(e%d)Z&d*efd+YZ'd,Z(de(_)d-Z*d.Z+d/Z,ddd0Z-d1e fd2YZ.d3Z/xSeD]KZ0e1e0Z2e3e2d4r8e2j4d5e5kr8e/e2e1e0/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt__init__#s  cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt__iter__)scCs |jjS(N(Rtnext(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%,scCs9t|_t|jdr+|jjn|jdS(Ntclose(tTrueR!thasattrRR&R(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR&/s cCs$|js tjd|jIJndS(NsgError: app_iter.close() was not called when finishing WSGI request. finalization function %s not called(R!tsyststderrR(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt__del__5s (t__name__t __module__t__doc__R#R$R%R&R+(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs     cBs>eZdZddZdZdZdZdZRS(s An an iterable that iterates over app_iter, calls start_func before the first item is returned, then calls close_func at the end. cCs@||_t||_t|_||_||_t|_dS(N( RRRR'tfirstt start_funcRR R!(R"RR0R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#Ds     cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR$LscCs,|jr|jt|_n|jjS(N(R/R0R RR%(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%Os   cCsKt|_t|jdr+|jjn|jdk rG|jndS(NR&(R'R!R(RR&RtNone(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR&Us  cCs$|js tjd|jIJndS(NsgError: app_iter.close() was not called when finishing WSGI request. finalization function %s not called(R!R)R*R(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR+\s N( R,R-R.R1R#R$R%R&R+(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR=s     cBs;eZdZdZdZdZdZdZRS(sZ Chains several app_iters together, also delegating .close() to each of them. cGs8||_g|D]}t|^q|_t|_dS(N(t app_itersRtchainedR R!(R"R3titem((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#ks "cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR$pscCsjt|jdkr&|jdjSy|jdjSWn(tk re|jjd|jSXdS(Nii(tlenR3R%t StopIterationtpop(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%ss cCs~t|_d}xG|jD]<}y t|dr>|jnWqtj}qXqW|rz|d|d|dndS(NR&iii(R'R!R1R2R(R&R)texc_info(R"tgot_excR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR&}s cCs$|js tjd|jIJndS(NsgError: app_iter.close() was not called when finishing WSGI request. finalization function %s not called(R!R)R*R(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR+s (R,R-R.R#R$R%R&R+(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRds    cBs>eZdZejddZdZdZdZRS(s@ Encodes an app_iterable's unicode responses as strings tstrictcCs.||_t||_||_||_dS(N(RRRtencodingterrors(R"RR;R<((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#s  cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR$scCs=|jj}t|tr9|j|j|j}n|S(N(RR%t isinstancetunicodetencodeR;R<(R"tcontent((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%scCs&t|jdr"|jjndS(NR&(R(RR&(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR&s( R,R-R.R)tgetdefaultencodingR#R$R%R&(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs     cCspy|||}Wn|tjnXt|ttfkr\|rX|n|St|||SdS(s& Runs the application, and returns the application iterator (which should be passed upstream). If an error occurs then error_callback will be called with exc_info as its sole argument. If no errors occur and ok_callback is given, then it will be called with no arguments. N(R)R8ttypetlistttuplet_wrap_app_iter(t applicationtenvirontstart_responseterror_callbackt ok_callbackR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs REcBs#eZdZdZdZRS(cCsR||_t||_||_||_t|jdrN|jj|_ndS(NR&(RRRRIRJR(R&(R"RRIRJ((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#s    cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR$scCs^y|jjSWnFtk r=|jr7|jnn|jtjnXdS(N(RR%R6RJRIR)R8(R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%s   (R,R-R#R$R%(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyREs  cCsy|||}Wn$|k r9|||tjSXt|ttfkrl|dk rh|n|St|||||d|SdS(s Like ``catch_errors``, except error_callback_app should be a callable that will receive *three* arguments -- ``environ``, ``start_response``, and ``exc_info``. It should call ``start_response`` (*with* the exc_info argument!) and return an iterator. tcatchN(R)R8RBRCRDR1t_wrap_app_iter_app(RFRGRHterror_callback_appRJRKR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs     RLcBs&eZedZdZdZRS(cCsm||_||_||_t||_||_||_||_t|jdri|jj |_ ndS(NR&( RGRHRRRRMRJRKR(R&(R"RGRHRRMRJRK((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#s      cCs|S(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR$scCsy|jjSWntk r=|jr7|jnn|jk rt|jdr}y|jjWq}q}Xn|j|j |j t j }t |}t|dr|j|_n|j|_|jSXdS(NR&(RR%R6RJRKR(RR&RMRGRHR)R8R(R"tnew_app_iterableR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR%s&     (R,R-t ExceptionR#R$R%(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRLs tc sd|kstd|r*t}n t}i dd6dd6dd6dd 6d d 6d d 6d%d6dd6tdd6|d6td6td6td6}|r tt|\}}}}} tj|}t|t|}}||d<|r ||d/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRHFs    sAThe app_iter response can only contain str (not unicode); got: %rsContent sent w/o headers!s iterable: %rNR&RaRb(ii(Rct ErrorRaiserRR RtstrturllibtunquotetitemstreplaceR=R5R1t ValueErrorRdR't TypeErrortargsR(R&tjointgetvalue(RFtpathtraise_on_wsgi_errorRGR<t basic_environt_RQtquerytfragmenttnametvaluetistreamRHRtste((ReRfRgRhs>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRsv    !       & RicBs,eZdZdZdZdZRS(cCsdS(N((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pytflushpscCs|s dStd|dS(Ns%No errors should be written (got: %r)(Rc(R"R{((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pytwritesscCstdt|dS(Ns+No errors should be written (got lines: %s)(RcRC(R"tseq((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt writelinesyscCsdS(NRP((R"((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs}s(R,R-RRRRs(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRins   c Ost||\}}}}t}|rZ|jd|j|j|jdn|j|dx+|D]#\}}|jd||fqrW|jd|j||jS(sx Runs the application interatively, wrapping `raw_interactive` but returning the output in a formatted way. sErrors: s ----------end errors s s%s: %s (RRRtstripRs( RqtkwRaRbR@R<tfullRzR{((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs    cCsg}|j}|jxA|D]9}t||jdd}|jd||fq#W|jd|jdd}|r|j|djt||jdndj|}d d tt |fg}|d ||gS( sl Application which simply dumps the current environment variables out as a plain text response. s s s%s: %s R`RPs wsgi.inputs Content-Types text/plainsContent-Lengths200 OK(s Content-Types text/plain( tkeystsortRjRnRdtgettreadtintRrR5(RGRHRhRtktvtcontent_lengthRb((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs       cCs0tjdtdddlm}|j|S(Ns9wsgilib.send_file has been moved to paste.fileapp.FileAppii(tfileapp(twarningstwarntDeprecationWarningtpasteRtFileApp(tfilenameR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs  cstjdtdgtdfd}|||}z"x|D]}j|qSWWdt|dr|jnXsjdnt dkrjdnjj S(s Runs application with environ and start_response, and captures status, headers, and body. Sends status and header, but *not* body. Returns (status, headers, body). Typically this is used like: .. code-block:: python def dehtmlifying_middleware(application): def replacement_app(environ, start_response): status, headers, body = capture_output( environ, start_response, application) content_type = header_value(headers, 'content-type') if (not content_type or not content_type.startswith('text/html')): return [body] body = re.sub(r'<.*?>', '', body) return [body] return replacement_app sOwsgilib.capture_output has been deprecated in favor of wsgilib.intercept_outputicsArg(nj|j||||jS(N(RdR(RaRbR8(ReRhRH(s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pytreplacement_start_responses    NR&( RRRRR1RR(R&RdR5Rs(RGRHRFRRR4((ReRhRHs>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs$   csdk r'dkr'tdngtdfd}|||}ddkr}dd|fSz"x|D]}j|qWWdt|dr|jnXsjdntdkrjdnjjS(s Runs application with environ and captures status, headers, and body. None are sent on; you must send them on yourself (unlike ``capture_output``) Typically this is used like: .. code-block:: python def dehtmlifying_middleware(application): def replacement_app(environ, start_response): status, headers, body = intercept_output( environ, application) start_response(status, headers) content_type = header_value(headers, 'content-type') if (not content_type or not content_type.startswith('text/html')): return [body] body = re.sub(r'<.*?>', '', body) return [body] return replacement_app A third optional argument ``conditional`` should be a function that takes ``conditional(status, headers)`` and returns False if the request should not be intercepted. In that case ``start_response`` will be called and ``(None, None, app_iter)`` will be returned. You must detect that in your code and return the app_iter, like: .. code-block:: python def dehtmlifying_middleware(application): def replacement_app(environ, start_response): status, headers, body = intercept_output( environ, application, lambda s, h: header_value(headers, 'content-type').startswith('text/html'), start_response) if status is None: return body start_response(status, headers) body = re.sub(r'<.*?>', '', body) return [body] return replacement_app s?If you provide conditional you must also provide start_responsecsjdk r9|| r9jd|||SrIg(nj|j|jS(N(R1RdR(RaRbR8(t conditionalReRhRH(s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs    iNR&i( R1RpRRR(R&RdR5Rs(RGRFRRHRRR4((RReRhRHs>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyRs(.     tResponseHeaderDictcBseZdZRS(cOs*tjdtdtj|||dS(NsPThe class wsgilib.ResponseHeaderDict has been moved to paste.response.HeaderDicti(RRRRR#(R"RqR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR#3s (R,R-R#(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyR1scsQjjddfd}yj|_WnnX|S(NR,R^cs*tjdftd||S(Ns,The function wsgilib.%s has been moved to %si(RRR(RqR(tnew_functnew_nametnew_path(s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt replacement=s   (t func_namet func_globals(RR((RRRs>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pyt_warn_deprecated:s RR,t__main__(8R.t paste.requestRRRRRRtpaste.responseRRRR R R R t tracebackR Rkt cStringIORR)turlparseRRt__all__tobjectRRRRR1RRERORRLR RRiRtproxyRRRRRRt_nametglobalst_funcR(RR,tdoctestttestmod(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/wsgilib.pytsV"         '- 'Y     2 N