
    h                     b    d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	 ddl
mZ  G d de      Zy)	    N)Http404HttpResponseHttpResponseNotModified)	http_date)was_modified_since   )
ServerBasec                       e Zd ZdZd Zy)DefaultServerz
    Serve static files from the local filesystem through django.
    This is a bad idea for most situations other than testing.

    This will only work for files that can be accessed in the local filesystem.
    c                    |j                   }t        j                   j                  |      st        d|z        t        j                  |      }d|j
                  i}t        |j                  j                  d      |t        j                           st        di |S t        t        |d      j                         fi |}t        |t        j                           |d<    | j                  d|||j                   d| |S )Nz"%s" does not existcontent_typeHTTP_IF_MODIFIED_SINCErbzLast-Modified)requestresponsefile_obj )pathosexistsr   stat	mime_typer   METAgetST_MTIMEr   r   openreadr   default_headersfile)selfr   
filer_filekwargsfullpathstatobjresponse_paramsr   s           M/home/dcms/DCMS/lib/python3.12/site-packages/filer/server/backends/default.pyservezDefaultServer.serve   s    ?? ww~~h'/(:;;''(#):+?+?@!',,"2"23K"L")$--"8:*=_==Xt 4 9 9 ;OO$-gdmm.D$E!dWx*//d]cd    N)__name__
__module____qualname____doc__r'   r   r(   r&   r   r      s    r(   r   )r   r   django.httpr   r   r   django.utils.httpr   django.views.staticr   baser	   r   r   r(   r&   <module>r1      s&    	  F F ' 2 J r(   