PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  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/e2e1e0eZdZddZdZdZdZdZRS(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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#Ds     cCs|S(N((R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR$LscCs,|jr|jt|_n|jjS(N(R/R0R RR%(R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR%Os   cCsKt|_t|jdr+|jjn|jdk rG|jndS(NR&(R'R!R(RR&RtNone(R"((s1/usr/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"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR+\s N( R,R-R.R1R#R$R%R&R+(((s1/usr/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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#ks "cCs|S(N((R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR$pscCsjt|jdkr&|jdjSy|jdjSWn(tk re|jjd|jSXdS(Nii(tlenR3R%t StopIterationtpop(R"((s1/usr/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((s1/usr/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"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR+s (R,R-R.R#R$R%R&R+(((s1/usr/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<((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#s  cCs|S(N((R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR$scCs=|jj}t|tr9|j|j|j}n|S(N(RR%t isinstancetunicodetencodeR;R<(R"tcontent((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR%scCs&t|jdr"|jjndS(NR&(R(RR&(R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR&s( R,R-R.R)tgetdefaultencodingR#R$R%R&(((s1/usr/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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyRs REcBs#eZdZdZdZRS(cCsR||_t||_||_||_t|jdrN|jj|_ndS(NR&(RRRRIRJR(R&(R"RRIRJ((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#s    cCs|S(N((R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR$scCs^y|jjSWnFtk r=|jr7|jnn|jtjnXdS(N(RR%R6RJRIR)R8(R"((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR%s   (R,R-R#R$R%(((s1/usr/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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyRs     RLcBs&eZedZdZdZRS(cCsm||_||_||_t||_||_||_||_t|jdri|jj |_ ndS(NR&( RGRHRRRRMRJRKR(R&(R"RGRHRRMRJRK((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#s      cCs|S(N((R"((s1/usr/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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR%s&     (R,R-t ExceptionR#R$R%(((s1/usr/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', '', 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(s1/usr/lib/python2.7/site-packages/paste/wsgilib.pytreplacement_start_responses    NR&( RRRRR1RR(R&RdR5Rs(RGRHRFRRR4((ReRhRHs1/usr/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(s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyRs    iNR&i( R1RpRRR(R&RdR5Rs(RGRFRRHRRR4((RReRhRHs1/usr/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((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyR#3s (R,R-R#(((s1/usr/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(s1/usr/lib/python2.7/site-packages/paste/wsgilib.pyt replacement=s   (t func_namet func_globals(RR((RRRs1/usr/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(((s1/usr/lib/python2.7/site-packages/paste/wsgilib.pytsV"         '- 'Y     2 N