Ñò ô†³Kc @sædZddkZddkZddkZddkZddkZddkTddkTdZdZ dddd gZ de fd „ƒYZ de fd „ƒYZ d e fd „ƒYZde fd„ƒYZd e fd„ƒYZdS(s¦ This module handles sending static content such as in-memory data or files. At this time it has cache helpers and understands the if-modified-since request header. iÿÿÿÿN(t*iitDataApptFileAppt DirectoryAppt ArchiveStorecBs\eZdZd Zd d d„Zd„Zd d„Zd„Zd„Z d„Z d „Z RS( s¨ Returns an application that will send content in a single chunk, this application has support for setting cache-control and for responding to conditional (or HEAD) requests. Constructor Arguments: ``content`` the content being sent to the client ``headers`` the headers to send /w the response The remaining ``kwargs`` correspond to headers, where the underscore is replaced with a dash. These values are only added to the headers if they are not already provided; thus, they can be used for default values. Examples include, but are not limited to: ``content_type`` ``content_encoding`` ``content_location`` ``cache_control()`` This method provides validated construction of the ``Cache-Control`` header as well as providing for automated filling out of the ``EXPIRES`` header for HTTP/1.0 clients. ``set_content()`` This method provides a mechanism to set the content after the application has been constructed. This method does things like changing ``Last-Modified`` and ``Content-Length`` headers. tGETtHEADcKsæd|_d|_d|_d|_|dj o ||_n|pg|_x9|iƒD]+\}}t|ƒ}|i |i|ƒq[Wt i |idt ƒt |iƒpt i |iƒn|dj o|i |ƒndS(Nitbytes(tNonetexpirestcontenttcontent_lengtht last_modifiedtallowed_methodstheaderstitemst get_headertupdatet ACCEPT_RANGEStTruet CONTENT_TYPEt set_content(tselfR RR tkwargstktvtheader((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt__init__;s          cKs#ti|i|pd|_|S(N(t CACHE_CONTROLtapplyRRR (RR((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt cache_controlNscCs^|djotiƒ|_n ||_||_t|ƒ|_ti|id|iƒ|S(Nttime( RRR R tlenR t LAST_MODIFIEDRR(RR R ((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRRs   cKsti|i||S(N(tCONTENT_DISPOSITIONRR(RR((s1/usr/lib/python2.6/site-packages/paste/fileapp.pytcontent_disposition]scCsi|diƒ}||ijo9td|dddi|iƒfgƒ}|||ƒS|i||ƒS(NtREQUEST_METHODsYou cannot %s a fileRtAllowt,(tupperR tHTTPMethodNotAllowedtjointget(Rtenvirontstart_responsetmethodtexc((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt__call__as cCsd|i|ifS(Ns"%s-%s"(R R (R((s1/usr/lib/python2.6/site-packages/paste/fileapp.pytcalculate_etagjscCsò|i}|iƒ}ti||ƒ|idj oti|d|iƒny…ti|ƒ}|okxh|D]\}||jp |djo<x$t dt ƒD]}|i |ƒq W|d|ƒdgSqpWnWn"t j o}|i ||ƒSX|pŽyeti|ƒ} | t|iƒjo<x$t dt ƒD]}|i |ƒq9W|d|ƒdgSWqt j o}|i ||ƒSXnd|id} } ti|ƒ} | o›d| djoŠdt| dƒjos| dd\} } | p |id} | |ijp | | jo*td |it|ƒfƒi ||ƒSn| | d} ti|d | d | d |iƒti|| ƒ| |ijo|d |ƒn|d|ƒ|idj o|i| | d!gS| | fS(NtdeltaRtentitys304 Not ModifiedtiiRsWRange request was made beyond the end of the content, which is %s long. Range: %s t first_bytet last_bytet total_lengths200 OKs206 Partial Content(RR0tETAGRR RtEXPIRESt IF_NONE_MATCHtparset list_headersRtdeletetHTTPBadRequesttwsgi_applicationtIF_MODIFIED_SINCEtintR R tRANGER tHTTPRequestRangeNotSatisfiablet CONTENT_RANGEtCONTENT_LENGTHR (RR+R,Rt current_etagt client_etagstetagtheadtexcet client_clocktlowerR'trangeR ((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR*msb     /  (RRN( t__name__t __module__t__doc__R RRRRR#R/R0R*(((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRs"   cBs8eZdZdd„Zd„Zed„Zd„ZRS(sÁ Returns an application that will send the file at the given filename. Adds a mime type based on ``mimetypes.guess_type()``. See DataApp for the arguments beyond ``filename``. cKsy||_|iƒ\}}|od|jo||dRR*t isinstancetlisttseekRt BLOCK_SIZEt _FileIter( RR+R,tis_headR.tfiletetretvalRKR t file_wrapper((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR*Ìs<     N( RMRNRORRRStFalseRR*(((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR©s   RlcBs2eZddd„Zd„Zd„Zd„ZRS(cCs&||_||_|pt|_dS(N(RnRaRkt block_size(RRnRsRa((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRñs  cCs|S(N((R((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt__iter__öscCsp|i}|idj o0||ijo |i}n|i|8_n|ii|ƒ}|p t‚n|S(N(RsRaRRnR\t StopIteration(Rt chunk_sizetdata((s1/usr/lib/python2.6/site-packages/paste/fileapp.pytnextùs   cCs|iiƒdS(N(RnR](R((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR]sN(RMRNRRRtRxR](((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRlïs  cBs&eZdZd„ZeZd„ZRS(s Returns an application that dispatches requests to corresponding FileApps based on PATH_INFO. FileApp instances are cached. This app makes sure not to serve any files that are not in a subdirectory. To customize FileApp creation override ``DirectoryApp.make_fileapp`` cCsTtii|ƒ|_|iitiiƒp|itii7_nh|_dS(N(RVRbtabspathtendswithtsept cached_apps(RRb((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRscCsÉ|d}|ii|ƒ}|djo“tii|i|idƒƒ}tii|ƒi|iƒp t ƒ}q¼tii |ƒo |i |ƒ}||i|RRRzRTRSRRRR\Rtmktimet date_timeR ( RR+R,Rbt applicationtinfoR.RPRQR…((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR/Fs,   (RMRNRORRR/(((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyR's i(RORVRRTR‡R‹tpaste.httpexceptionstpaste.httpheadersRZRkt__all__tobjectRRRlRR(((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt s<  ”F