Ñò ô†³Kc @ sæ d Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Td d k Td Z d Z d d d d g Z d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d S( 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 *i i t DataAppt FileAppt DirectoryAppt ArchiveStorec B s\ e Z d Z d Z d d d „ Z d „ Z d d „ Z d „ Z d „ 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. t GETt HEADc K sæ d | _ d | _ d | _ d | _ | d j o | | _ n | p g | _ x9 | i ƒ D]+ \ } } t | ƒ } | i | i | ƒ q[ Wt i | i d t ƒt | i ƒ p t i | i ƒ n | d j o | i | ƒ n d S( Ni t bytes( t Nonet expirest contentt content_lengtht last_modifiedt allowed_methodst headerst itemst get_headert updatet ACCEPT_RANGESt Truet CONTENT_TYPEt set_content( t selfR R R t kwargst kt vt header( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyt __init__; s c K s# t i | i | p d | _ | S( N( t CACHE_CONTROLt applyR R R ( R R ( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyt cache_controlN s c C s^ | d j o t i ƒ | _ n | | _ | | _ t | ƒ | _ t i | i d | i ƒ| S( Nt time( R R R R t lenR t LAST_MODIFIEDR R ( R R R ( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyR R s c K s t i | i | | S( N( t CONTENT_DISPOSITIONR R ( R R ( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyt content_disposition] s c C si | d i ƒ } | | i j o9 t d | d d d i | i ƒ f g ƒ} | | | ƒ S| i | | ƒ S( Nt REQUEST_METHODs You cannot %s a fileR t Allowt ,( t upperR t HTTPMethodNotAllowedt joint get( R t environt start_responset methodt exc( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyt __call__a s c C s d | i | i f S( Ns "%s-%s"( R R ( R ( ( s1 /usr/lib/python2.6/site-packages/paste/fileapp.pyt calculate_etagj s c C sò | i } | i ƒ } t i | | ƒ | i d j o t i | d | i ƒn y… t i | ƒ } | ok xh | D]\ } | | j p | d j o<