ÿØÿà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Áß_ÿÙ aNc@sdZddlZddlZddlZddlZddlZddlTddlTdZdZ dddd gZ de fd YZ de fd YZ d e fd YZde fdYZd e fdYZdS(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. iN(t*iitDataApptFileAppt DirectoryAppt ArchiveStorecBs\eZdZd Zd d dZdZd dZdZdZ dZ 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. tGETtHEADcKst|tdtfs!td|_d|_d|_d|_|dk r]||_ n|pfg|_ x9|j D]+\}}t |}|j |j |qyWtj |j dtt|j stj |j n|dk r|j|ndS(Nitbytes(t isinstancettypetNonetlisttAssertionErrortexpirestcontenttcontent_lengtht last_modifiedtallowed_methodstheaderstitemst get_headertupdatet ACCEPT_RANGEStTruet CONTENT_TYPEt set_content(tselfRRRtkwargstktvtheader((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyt__init__;s !        cKs"tj|j|pd|_|S(N(t CACHE_CONTROLtapplyRR R (RR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyt cache_controlNscCsn|dk st|dkr0tj|_n ||_||_t||_tj|j d|j|S(Nttime( R R R#RRtlenRt LAST_MODIFIEDRR(RRR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRRs   cKstj|j||S(N(tCONTENT_DISPOSITIONR!R(RR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pytcontent_disposition]scCsg|dj}||jkrWtd|dddj|jfg}|||S|j||S(NtREQUEST_METHODsYou cannot %s a fileRtAllowt,(tupperRtHTTPMethodNotAllowedtjointget(Rtenvirontstart_responsetmethodtexc((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyt__call__as  cCsd|j|jfS(Ns"%s-%s"(RR(R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pytcalculate_etagjscCs|j}|j}tj|||jdk rNtj|d|jnytj|}|rxd|D]Y}||ks|dkrmx$t dt D]}|j |qW|d|dgSqmWnWn t k r}|j ||SX|syctj|} | t|jkrYx$t dt D]}|j |q.W|d|dgSWqt k r|}|j ||SXnd|jd} } tj|} | r=d| dkr=dt| dkr=| dd\} } | p|jd} | |jks| | kr=td |jt|fj ||Sn| | d} tj|d | d | d |jtj|| | |jkr|d |n |d||jdk r|j| | 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((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR.ms\      ,   (RRN( t__name__t __module__t__doc__RR RR"RR'R3R4R.(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs"   cBs8eZdZddZdZedZdZRS(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``. cKss||_|j\}}|r:d|kr:||d/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs   cCstj|jS(N(t mimetypesRWRV(R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRWscCstj|j}| r/|j|jkr/dS|j|_|jtkrt|jd}|j|j |j|j n.d|_ |j|_ tj|jd|jdS(NtrbR#(toststatRVtst_mtimeRtst_sizet CACHE_SIZEtopenRtreadtcloseR RRR%RR(RtforceR[tfh((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs    c Csu|djdk}dt|jkrA|jdtn |j|jstjj|j st ddd|j }|||Syt |j d}Wqt t fk r}td |}|j||SXntj|||}t|tr|rd gS|S|\}} |r/d gS|j||jd d} | ra| |tSt|d | SdS( NR(Rs max-age=0RbsThe resource does not existtcomments No file at %rRYs,You are not permitted to view this file (%s)R7swsgi.file_wrappertsize(R+R RORRRRZtpathtexistsRVt HTTPNotFoundR_tIOErrortOSErrort HTTPForbiddenRBRR.RR tseekR t BLOCK_SIZEt _FileIter( RR/R0tis_headR2tfiletetretvalRORt file_wrapper((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR.s<       N( RQRRRSR RRWtFalseRR.(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs   RncBs2eZdddZdZdZdZRS(cCs%||_||_|pt|_dS(N(RpReRmt block_size(RRpRuRe((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs  cCs|S(N((R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyt__iter__scCsj|j}|jdk rE||jkr3|j}n|j|8_n|jj|}|sftn|S(N(RuReR RpR`t StopIteration(Rt chunk_sizetdata((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pytnexts   cCs|jjdS(N(RpRa(R((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRasN(RQRRR RRvRzRa(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRns  cBs&eZdZdZeZdZRS(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`` cCsmtjj||_|jjtjjsE|jtjj7_ntjj|js`ti|_dS(N(RZRftabspathtendswithtseptisdirR t cached_apps(RRf((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs cCs|d}|jj|}|dkrtjj|j|jd}tjj|j|jsst }qtjj |r|j |}||j|/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR3s  ! (RQRRRSRRRR3(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyRs cBs)eZdZdZdZdZRS(s Returns an application that serves up a DataApp for items requested in a given zip or tar archive. Constructor Arguments: ``filepath`` the path to the archive being served ``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. cCstj|r'tj|d|_n7tj|rNtj|d|_ntd|d|_ t j |_ i|_ dS(Ntrs"filepath '%s' is not a zip or tar ( tzipfilet is_zipfiletZipFiletarchivettarfilet is_tarfilet TarFileCompatR R R R#Rtcache(Rtfilepath((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR7s cKs"tj|j|pd|_|S(N(R R!RR R (RR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR"Bsc Cso|jdd}|jdr.|d}n|jj|}|rS|||Sy|jj|}Wn.tk rtd|}|j||SX|jj drtd|}|j||St j |j\}}|dk r t dd|d|} nt dd|} | j|jj|tj|jd | |j|<|j| _| ||S( NRR7Ris(The file requested, '%s', was not found.s$Path requested, '%s', is not a file.RTRUi(iii(R.RRRtgetinfotKeyErrorRhRBRVR|RXRWR RRR`R#tmktimet date_timeR ( RR/R0Rft applicationtinfoR2RTRUR((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR3Fs0       (RQRRRSRR"R3(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyR's i(RSRZR#RXRRtpaste.httpexceptionstpaste.httpheadersR^Rmt__all__tobjectRRRnRR(((s>/opt/alt/python27/lib/python2.7/site-packages/paste/fileapp.pyt s<  F