Ñò PhEc@sFddkZddkZddkZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZd efd „ƒYZ defd„ƒYZ de fd„ƒYZ de fd„ƒYZ de fd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿNt_LinkcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs ||_dS(N(tparent(tselfR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt__init__ scCs td‚dS(sTWrite text to the buffer chain. See also `RequestBuffer.write()`_. s(pure virtual)N(tNotImplementedError(Rttext((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytwritescCsdS(N((R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytflushscCsdS(N((R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytclearscCs'dti|ƒdd!t|iƒfS(Ns<%s: Parent: %s>iiÿÿÿÿ(tobjectt__repr__treprR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR s(t__name__t __module__RRRRR (((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR s     t_BuffercBs/eZdd„Zd„Zd„Zd„ZRS(cCsIti||ƒ|djotiƒ}n||_|ii|_dS(N(RRtNonetStringIOtbufferR(RRR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR"s   cCs|ii|ƒdS(N(RR(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR)scCs7|iidƒ|ii|iiƒƒ|iƒdS(Ni(RtseekRRtreadR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR.scCs2|iidƒy|iidƒWnnXdS(Ni(RttruncateR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR3s N(R R RRRRR(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR!s   t_TransparentBuffercBs2eZdZd„Zd„Zd„Zd„ZRS(s(A buffer which defers all recoding. cCsti||ƒg|_dS(N(RRt_buf(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR<scCs|ii|ƒdS(N(Rtappend(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR@scCs*|iidi|iƒƒ|iƒdS(Nt(RRtjoinRR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRCscCs g|_dS(N(R(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRGs(R R t__doc__RRRR(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR9s    t_CaptureBuffercBseZdZRS(s%A buffer used to capture output. (R R R(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRJst_EncodedBuffercBs}eZdZeiƒdd„Zd„Zd„Zd„Zd„Z d„Z e e dd ƒZ d „Z e e dd ƒZRS( s4This is a buffer which expects encoded strings. tstrictcCs0ti|||ƒd|_|i||ƒdS(N(RRRt_writert set_encoding(RRRtencodingterrors((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRRs cCse|io|iiƒnti|ƒd}||i|ƒ|_|ii|_||f|_dS(Ni(RtresettcodecstlookupRRt_EncodedBuffer__encoding(RR R!t stream_writer((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRXs  cCs|ii|ƒdS(N(RR(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR`scCs|iiƒti|ƒdS(N(RR"RR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRcs cCs|iiƒti|ƒdS(N(RR"RR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRgs cCs |idS(Ni(R%(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt get_encodingkstdocsEncoding of the output stream.cCs |idS(Ni(R%(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt get_errorspss6Encoding error handling strategy of the output stream.(R R RtsystgetdefaultencodingRRRRRR'tpropertyR R)R!(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyROs         t _StrBuffercBsMeZdZd„Zd„ZeeddƒZd„ZeeddƒZRS(s!This is a buffer which strs. cCsti|||ƒdS(N(RR(RRR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRxscCsdS(N(R(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR'{sR(sEncoding of the output stream.cCsdS(N(R(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR)€ss6Encoding error handling strategy of the output stream.( R R RRR'R,R R)R!(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR-us      t_FiltercBseZd„ZRS(cCsti||ƒ||_dS(N(RRtfilter(RRR/((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR†s(R R R(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR.…st_UnicodeFiltercBseZd„ZRS(cCs#|iit|i|ƒƒƒdS(N(RRtunicodeR/(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR‹s(R R R(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR0Šst _StrFiltercBseZd„ZRS(cCs#|iit|i|ƒƒƒdS(N(RRtstrR/(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRs(R R R(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR2Žst MismatchedPopcBseZRS((R R (((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR4”st_RequestBuffercBsÝeZd„Zd„Zed„Zd„Zd„Zdd„Z d„Z d„Z d„Z d „Z ed „Zdd d „Zd „Zd„Zd„Zed„ddƒZed„ddƒZdd„Zd„ZRS(cCs||_|_dS(N(t_topt_RequestBuffer__root(Rttop((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR™scCs|itƒdS(s$Push a component output buffer. These buffers are used to buffer component output temporarily. When the buffer is flushed, it passes it contents on to the next buffer in the stack. Normally the buffers are flushed when they are popped off the stack. N(t_RequestBuffer__pushR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt push_bufferœscCs(|itƒ}|p|iƒndS(s×Pop a component output buffer The argument ``discard``, if set, specifies that the contents of the buffer are to be discarded, rather than passed on to the next buffer in the stack. N(t_RequestBuffer__popRR(Rtdiscardtbuf((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt pop_buffer¦scCs|i|id|ƒdS(s4Push a filter. The filter function gets passed either a ``unicode`` or a system default encoded ``str``. If the ``disable_unicode`` config parameter is set, the filter always gets a ``str``. The filter can return any type acceptable to the `write`_ method. R/N(R9t _FilterType(RR/((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt push_filter±s cCs|i|iƒiS(s<Pop a filter. Returns the filter function. (R;R?R/(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt pop_filter¾scCs|itd|ƒdS(s£Push a capture buffer. This is a buffer used to capture component output. It does not propagate its contents down the buffer chain when it is popped. The ``buffer`` should be a file-like object supporting at least the ``write()`` method. The strings passed to ``buffer.write()`` will be ``unicode``s or system default (usually ASCII) encoded ``str``s. RN(R9R(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytpush_capture_bufferÅs cCs|itƒiS(sSPop a capture buffer of the stack. Returns the underlying buffer. (R;RR(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytpop_capture_bufferÓscKs||i||_|iS(N(R6(Rt link_classtkw((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt__pushÚscGsX|i}t||ƒp/tdttd„|ƒƒ|iif‚n|i|_|S(Ns&RequestBuffer.pop* expected %s, got %scSs|iS((R (tx((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pytãs(R6t isinstanceR4R tmapt __class__R R(Rtexpected_link_classestlink((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt__popÞs  cCs |ifS(s°Get the current state of the buffer stack. Returns an opaque value, which can be pssed to `pop_to_state`_ to restore the buffer to it's current state. (R6(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt get_stateèsc CsÀ|\}t|tƒp td‚ng}xV|iddƒD]9}||joPq?t|tƒp|i|ƒq?q?Wtd‚z*|px|D]}|iƒq–WnWd||_XdS(sNPop buffers, and restore saved state. Buffers are popped from the stack back to the position of the saved state. (The buffers are flushed as they are popped, unless ``discard`` parameter is set.) After the stack is unwound, the ``errors`` attribute is restored to what it was at the time the state was saved. If a ``UnicodeError`` is thrown while flushing buffers, no further buffers are flushed. However the stack is still unwound and the buffer state restored before the exception is re-raised. s invalid statetendN( RIRt ValueErrort_RequestBuffer__bufsRRRRR6(RtstateR<R8t bufs_to_flushtbR=((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt pop_to_stateðs"    trootccsa|djo |i}n|djo |i}n|}x ||j o|V|i}q=WdS(NRW(RR6R7R(RtbeginRPRU((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt__bufss     cCs td‚dS(s"Write text to the buffer. s pure virtualN(R(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR scCs:x3|iƒD]%}t|tƒoPn|iƒq WdS(sÊFlush output. Output is flushed up the first capture buffer in the stack. If there is no capture buffer, then output is flushed all the way to the final output buffer. N(RRRIRR(RR=((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR%s  cCs%x|iƒD]}|iƒq WdS(s)Clears all buffers in the stack. N(RRR(RR=((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR1s cCs |iiS((R7R (R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRH8sR(sµThe current output encoding of the buffer. Output written to the underlying output buffer (e.g. the Apache request object) are encoded using this encoding. cCs |iiS((R7R!(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRH@ssŒThe current encoding error handling strategy. This is the error handling strategy of the underlying output buffer. RcCs|ii||ƒdS(s4Set encoding of output to the final buffer. N(R7R(RR R!((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRGscCsd|iit|iƒfS(Ns<%s: %s>(RKR R R6(R((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR LsN(R R RR:tFalseR>R@RARRBRCR9R;RORVRRRRRR,R R!RR (((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR5˜s.       %       tUnicodeRequestBuffercBs#eZeZdd„Zd„ZRS(RcCs)td|||ƒ}ti||ƒdS(sºConstructor. The ``output_buffer`` is assumed to be a buffer like stdout or an apache request object, so we will not do anything but ``.write()`` to it. N(RRR5R(Rt output_buffertoutput_encodingR!R8((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRSscCs,|djodS|iit|ƒƒdS(s6Write text to the buffer. .. _`RequestBuffer.write()`: If ``text`` is a plain ``str``, it is interpreted according to the value of the system default encoding (obtainable from ``sys.getdefaultencoding()``.) Otherwise, if ``text`` is a ``unicode`` object or has a ``__unicode__`` method, it is treated as unicode. Finally, if ``text`` is neither a ``str`` nor convertable to a ``unicode``, it is coerced to a ``str`` and interpreted according to the system default encoding. N(RR6RR1(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR]s (R R R0R?RR(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR[Os tStrRequestBuffercBs eZeZd„Zd„ZRS(cCsti|td|ƒƒdS(sºConstructor. The ``output_buffer`` is assumed to be a buffer like stdout or an apache request object, so we will not do anything but ``.write()`` to it. N(R5RR-R(RR\((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyRuscCs,|djodS|iit|ƒƒdS(s"Write text to the buffer. N(RR6RR3(RR((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR~s (R R R2R?RR(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyR^qs (R#R*RR RRRRRR-R.R0R2t ExceptionR4R5R[R^(((s8/usr/lib/python2.6/site-packages/myghty/requestbuffer.pyt s$&·"