Ñò ô†³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 t|tdƒtfƒpt‚d|_d|_d|_d|_|dj o ||_ n|pg|_ x9|i ƒD]+\}}t |ƒ}|i |i |ƒq~Wti |i dtƒt|i ƒpti |i ƒn|dj o|i|ƒndS(Nitbytes(t isinstancettypetNonetlisttAssertionErrortexpirestcontenttcontent_lengtht last_modifiedtallowed_methodstheaderstitemst get_headertupdatet ACCEPT_RANGEStTruet CONTENT_TYPEt set_content(tselfRRRtkwargstktvtheader((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt__init__;s"#         cKs#ti|i|pd|_|S(N(t CACHE_CONTROLtapplyRR R (RR((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt cache_controlNscCsr|dj pt‚|djotiƒ|_n ||_||_t|ƒ|_ti|i d|iƒ|S(Nttime( R R R#RRtlenRt LAST_MODIFIEDRR(RRR((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyRRs   cKsti|i||S(N(tCONTENT_DISPOSITIONR!R(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,(tupperRtHTTPMethodNotAllowedtjointget(Rtenvirontstart_responsetmethodtexc((s1/usr/lib/python2.6/site-packages/paste/fileapp.pyt__call__as cCsd|i|ifS(Ns"%s-%s"(RR(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(RR4tETAGRR R tEXPIRESt IF_NONE_MATCHtparset list_headersRtdeletetHTTPBadRequesttwsgi_applicationtIF_MODIFIED_SINCEtintRRtRANGER$tHTTPRequestRangeNotSatisfiablet CONTENT_RANGEtCONTENT_LENGTHR(RR/R0Rt 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__RR RR"RR'R3R4R.(((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||d s<  ”F