
    ,iLf                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZ d dlmZ d dlmZmZ d dlmZ d dlmZmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlm Z  d dl!m"Z" d dl#m$Z$ d dl%m&Z&m'Z'm(Z( d dl)m*Z*  e*dejV                        Z, G d de       Z- G d de.      Z/ G d d      Z0 G d de0      Z1 G d de0      Z2 G d de2      Z3 G d de1      Z4 G d  d!e4      Z5 G d" d#e4      Z6 G d$ d%e1      Z7 G d& d'e1      Z8 G d( d)e1      Z9 G d* d+e1      Z: G d, d-e1      Z; G d. d/e1      Z< G d0 d1e1      Z= G d2 d3e>      Z? G d4 d5e1      Z@y)6    N)Header)	responses)urlsplit)async_to_syncsync_to_async)settings)signalssigning)DisallowedRedirect)DjangoJSONEncoder)SimpleCookie)timezone)CaseInsensitiveMapping)
iri_to_uri)cached_property)MAX_URL_LENGTHcontent_disposition_header	http_date)_lazy_re_compilez ;\s*charset=(?P<charset>[^\s;]+)c                   4    e Zd Zd ZddZd Zd Zd	dZd Zy)
ResponseHeadersc                 T    i | _         |r| j                  |      D ]
  \  }}|| |<    yy)zm
        Populate the initial data using __setitem__ to ensure values are
        correctly encoded.
        N)_store_unpack_items)selfdataheadervalues       H/var/www/mymood/env/lib/python3.12/site-packages/django/http/response.py__init__zResponseHeaders.__init__"   s5    
 !%!3!3D!9$V ":     c                 2   	 t        |t              r|j                  |       n>t        |t              r|j	                  |      }nt        |      }|j                  |       d|v sd|v rt        d|d      	 |S # t        $ r}t        |t              rd|v sd|v st        |t              rd|v sd|v rt        d|d      ||r+t        |dt        j                        j                         }n|xj                  d	|z  z  c_
         Y d
}~|S d
}~ww xY w)z
        Convert headers key/value to ascii/latin-1 native strings.
        `charset` must be 'ascii' or 'latin-1'. If `mime_encode` is True and
        `value` can't be represented in the given charset, apply MIME-encoding.
        
z*Header values can't contain newlines (got )   
   utf-8)
maxlinelenz,, HTTP response headers must be in %s formatN)
isinstancestrencodebytesdecodeBadHeaderErrorUnicodeErrorr   sysmaxsizereason)r   r   charsetmime_encodees        r   _convert_to_charsetz#ResponseHeaders._convert_to_charset,   s   	%%W%E5)W-E
W%u}$@	K  !.( !  	
 5%(eun5#&DEMTU]$@	K ug#++FMMOJWTT  !	s   A7A< <	DBDDc                 &    | j                  |       y N)pop)r   keys     r   __delitem__zResponseHeaders.__delitem__S   s    r!   c                     | j                  |d      }| j                  |dd      }||f| j                  |j                         <   y )Nasciilatin-1T)r5   )r7   r   lowerr   r;   r   s      r   __setitem__zResponseHeaders.__setitem__V   sC    &&sG4((	t(L$'<CIIK r!   Nc                 V    | j                   j                  |j                         |      S r9   )r   r:   r@   )r   r;   defaults      r   r:   zResponseHeaders.pop[   s    {{syy{G44r!   c                     || vr|| |<   y y r9    rA   s      r   
setdefaultzResponseHeaders.setdefault^   s    d?DI r!   Fr9   )	__name__
__module____qualname__r    r7   r<   rB   r:   rG   rF   r!   r   r   r   !   s!    %%N0
5r!   r   c                       e Zd Zy)r/   NrI   rJ   rK   rF   r!   r   r/   r/   c       r!   r/   c                   .   e Zd ZdZdZ	 ddZed        Zej                  d        Zed        Z	e	j                  d        Z	d	 Z
e
Zed
        Zd Zd Zd Zd ZeZd ZddZ	 	 	 	 	 	 	 	 d dZd Zd!dZd"dZd Zd Zd Zd Zd Zd Zd Zd Zd Z y)#HttpResponseBasez
    An HTTP response base class with dictionary-accessed headers.

    This class doesn't handle content. It should not be used directly.
    Use the HttpResponse and StreamingHttpResponse subclasses instead.
       Nc                    t        |      | _        || _        d| j                  vr!|d| j                   }|| j                  d<   n|rt	        d      g | _        d | _        t               | _        d| _	        |=	 t        |      | _        d| j                  cxk  rdk  st	        d       t	        d      || _        y # t        t        f$ r t        d      w xY w)	NContent-Typeztext/html; charset=zX'headers' must not contain 'Content-Type' when the 'content_type' parameter is provided.Fz$HTTP status code must be an integer.d   iW  z4HTTP status code must be an integer from 100 to 599.)r   headers_charsetr4   
ValueError_resource_closers_handler_classr   cookiesclosedintstatus_code	TypeError_reason_phrase)r   content_typestatusr3   r4   rU   s         r   r    zHttpResponseBase.__init__q   s     'w/-#!4T\\NC+7DLL(8  "$ ##~H#&v;  $**1c1 !WXX 2 !WXX$ 	* H FGGHs   ;B? ?Cc                 r    | j                   | j                   S t        j                  | j                  d      S )NzUnknown Status Code)r_   r   getr]   r   s    r   reason_phrasezHttpResponseBase.reason_phrase   s4    *&&& }}T--/DEEr!   c                     || _         y r9   )r_   r   r   s     r   re   zHttpResponseBase.reason_phrase   s
    #r!   c                     | j                   | j                   S | j                  j                  d      x}r,t        j	                  |      x}r|d   j                  dd      S t        j                  S )NrS   r4   " )rV   rU   rc   _charset_from_content_type_researchreplacer   DEFAULT_CHARSET)r   r`   matcheds      r   r4   zHttpResponseBase.charset   sn    ==$==   <<++N;;<;7>>|LLwL
 y)11#r::'''r!   c                     || _         y r9   )rV   rg   s     r   r4   zHttpResponseBase.charset   s	    r!   c           
          dj                  | j                  j                         D cg c]+  \  }}|j                  d      dz   |j                  d      z   - c}}      S c c}}w )zHTTP headers as a bytestring.s   
r>   s   : r?   )joinrU   itemsr,   rA   s      r   serialize_headersz"HttpResponseBase.serialize_headers   sb    || #',,"4"4"6"6JC 

7#e+ell9.EE"6
 	
s   0A!
c                 F    d| j                   v rd| j                   d   z  S dS )NrS   z, "%s"rj   rU   rd   s    r   _content_type_for_reprz'HttpResponseBase._content_type_for_repr   s2     - t||N33	
 	
r!   c                 "    || j                   |<   y r9   rv   )r   r   r   s      r   rB   zHttpResponseBase.__setitem__   s    $Vr!   c                     | j                   |= y r9   rv   r   r   s     r   r<   zHttpResponseBase.__delitem__   s    LL r!   c                      | j                   |   S r9   rv   rz   s     r   __getitem__zHttpResponseBase.__getitem__   s    ||F##r!   c                     || j                   v S )z$Case-insensitive check for a header.rv   rz   s     r   
has_headerzHttpResponseBase.has_header   s    %%r!   c                 6    | j                   j                         S r9   )rU   rs   rd   s    r   rs   zHttpResponseBase.items   s    ||!!##r!   c                 :    | j                   j                  ||      S r9   )rU   rc   )r   r   	alternates      r   rc   zHttpResponseBase.get   s    ||	22r!   c
                 4   || j                   |<   |t        |t        j                        rt        j                  |      r.t        j
                  |t        j                  j                        }|t        j                  j                  t        j                  j                        z
  }
|
t        j                  d      z  }
d}|t        d      t        d|
j                  dz  |
j                  z         }n%|| j                   |   d<   nd	| j                   |   d<   |wt        |t        j                        r|j                         }t        |      | j                   |   d
<   |s0t        t!        j                          |z         | j                   |   d<   ||| j                   |   d<   ||| j                   |   d<   |rd| j                   |   d<   |rd| j                   |   d<   |	r0|	j#                         dvrt        d      |	| j                   |   d<   yy)a  
        Set a cookie.

        ``expires`` can be:
        - a string in the correct format,
        - a naive ``datetime.datetime`` object in UTC,
        - an aware ``datetime.datetime`` object in any time zone.
        If it is a ``datetime.datetime`` object then calculate ``max_age``.

        ``max_age`` can be:
        - int/float specifying seconds,
        - ``datetime.timedelta`` object.
        N)tz   )secondsz/'expires' and 'max_age' can't be used together.r   iQ expiresrj   zmax-agepathdomainTsecurehttponly)laxnonestrictz,samesite must be "lax", "none", or "strict".samesite)rZ   r*   datetimer   is_naive
make_awareutcnow	timedeltarW   maxdaysr   total_secondsr\   r   timer@   )r   r;   r   max_ager   r   r   r   r   r   deltas              r   
set_cookiezHttpResponseBase.set_cookie   s   2 "S'8#4#45$$W-&11'8;L;L;P;PQG("3"3"7"78;L;L;P;P"7"QQ ++A66&$%VWWae!3emm!CD/6S!),+-DLLi('8#5#56!//1+.w<DLLi(/8w9N/OS!),(,DLLf%*0DLLh'*.DLLh',0DLLj)~~'@@ !OPP,4DLLj) r!   c                 <    | j                   j                  ||       y)z,Set a header unless it has already been set.N)rU   rG   rA   s      r   rG   zHttpResponseBase.setdefault  s    U+r!   c                 z    t        j                  ||z         j                  |      } | j                  ||fi |S )N)salt)r
   get_cookie_signersignr   )r   r;   r   r   kwargss        r   set_signed_cookiez"HttpResponseBase.set_signed_cookie  s9    ))sTz:??FtsE4V44r!   c           	          |j                  d      xs |xr |j                         dk(  }| j                  |d|||d|       y )N)z	__Secure-z__Host-r   r   zThu, 01 Jan 1970 00:00:00 GMT)r   r   r   r   r   r   )
startswithr@   r   )r   r;   r   r   r   r   s         r   delete_cookiezHttpResponseBase.delete_cookie  sW    
  89 
3)V3 	 	3 	 	
r!   c                     t        |t        t        f      rt        |      S t        |t              r$t        |j	                  | j
                              S t        |      j	                  | j
                        S )z=Turn a value into a bytestring encoded in the output charset.)r*   r-   
memoryviewr+   r,   r4   rg   s     r   
make_byteszHttpResponseBase.make_bytes2  sX     eeZ01<eS!dll3445z  ..r!   c                     | j                   D ]
  }	  |         | j                   j                          d| _        t        j
                  j                  | j                         y # t        $ r Y dw xY w)NT)sender)rX   	Exceptionclearr[   r	   request_finishedsendrY   )r   closers     r   closezHttpResponseBase.closeG  sh    ,,F - 	$$&  %%T-@-@%A  s   A&&	A21A2c                 F    t        d| j                  j                  z        Nz This %s instance is not writableOSError	__class__rI   r   contents     r   writezHttpResponseBase.writeR      84>>;R;RRSSr!   c                      y r9   rF   rd   s    r   flushzHttpResponseBase.flushU  s    r!   c                 F    t        d| j                  j                  z        )Nz)This %s instance cannot tell its positionr   rd   s    r   tellzHttpResponseBase.tellX  s!    7$..:Q:QQ
 	
r!   c                      yNFrF   rd   s    r   readablezHttpResponseBase.readable`      r!   c                      yr   rF   rd   s    r   seekablezHttpResponseBase.seekablec  r   r!   c                      yr   rF   rd   s    r   writablezHttpResponseBase.writablef  r   r!   c                 F    t        d| j                  j                  z        r   r   )r   liness     r   
writelineszHttpResponseBase.writelinesi  r   r!   )NNNNNr9   )rj   NN/NFFN)rj   )r   NN)!rI   rJ   rK   __doc__r]   r    propertyre   setterr4   rt   	__bytes__rw   rB   r<   r|   r~   __contains__rs   rc   r   rG   r   r   r   r   r   r   r   r   r   r   r   rF   r!   r   rP   rP   g   s    K RV%< F F $ $ ( ( ^^ 
 "I
 
%!$& L$3 >5@,5
(/*	BT
Tr!   rP   c                        e Zd ZdZdZd fd	Zd Zd ZeZe	d        Z
e
j                  d        Z
ed        Zd	 Zd
 Zd Zd Zd Zd Z xZS )HttpResponsezs
    An HTTP response class with a string as content.

    This content can be read, appended to, or replaced.
    Fc                 2    t        |   |i | || _        y r9   )superr    r   )r   r   argsr   r   s       r   r    zHttpResponse.__init__v  s    $)&)r!   c                 d    d| j                   j                  | j                  | j                  dz  S Nz5<%(cls)s status_code=%(status_code)d%(content_type)s>)clsr]   r`   r   rI   r]   rw   rd   s    r   __repr__zHttpResponse.__repr__{  s4    F>>**++ 77J
 
 	
r!   c                 B    | j                         dz   | j                  z   S )z6Full HTTP message, including headers, as a bytestring.s   

)rt   r   rd   s    r   	serializezHttpResponse.serialize  s    %%'+5DDr!   c                 8    dj                  | j                        S Nr!   )rr   
_containerrd   s    r   r   zHttpResponse.content  s    xx((r!   c                 L    t        |d      rSt        |t        t        t        f      s8dj                   fd|D              }t        |d      r#	 |j                          n j                  |      }|g _	         j                  j                  dd        y # t        $ r Y 0w xY w)N__iter__r!   c              3   @   K   | ]  }j                  |        y wr9   r   ).0chunkr   s     r   	<genexpr>z'HttpResponse.content.<locals>.<genexpr>  s     I5%tu55s   r   text)hasattrr*   r-   r   r+   rr   r   r   r   r   __dict__r:   )r   r   r   s   `  r   r   zHttpResponse.content  s     5*%jE:s+/
 hhI5IIGug&KKM ooe,G")&$' ! s   B 	B#"B#c                 T    | j                   j                  | j                  xs d      S )Nr(   )r   r.   r4   rd   s    r   r   zHttpResponse.text  s     ||""4<<#:7;;r!   c                 ,    t        | j                        S r9   )iterr   rd   s    r   r   zHttpResponse.__iter__  s    DOO$$r!   c                 X    | j                   j                  | j                  |             y r9   )r   appendr   r   s     r   r   zHttpResponse.write  s    tw78r!   c                 ,    t        | j                        S r9   )lenr   rd   s    r   r   zHttpResponse.tell  s    4<<  r!   c                     | j                   S r9   )r   rd   s    r   getvaluezHttpResponse.getvalue  s    ||r!   c                      y)NTrF   rd   s    r   r   zHttpResponse.writable  s    r!   c                 4    |D ]  }| j                  |        y r9   )r   )r   r   lines      r   r   zHttpResponse.writelines  s    DJJt r!   )r!   )rI   rJ   rK   r   	streamingr    r   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__r   s   @r   r   r   m  s     I

E I) ) ^^( (" < <%9!r!   r   c                        e Zd ZdZdZd fd	Zd Zed        Zed        Z	ed        Z
e
j                  d        Z
d	 Zd
 Zd Zd Z xZS )StreamingHttpResponsea$  
    A streaming HTTP response class with an iterator as content.

    This should only be iterated once, when the response is streamed to the
    client. However, it can be appended to or replaced with a new iterator
    that wraps the original content (or yields entirely new content).
    Tc                 2    t        |   |i | || _        y r9   )r   r    streaming_content)r   r   r   r   r   s       r   r    zStreamingHttpResponse.__init__  s    $)&) "3r!   c                 d    d| j                   j                  | j                  | j                  dz  S r   )r   rK   r]   rw   rd   s    r   r   zStreamingHttpResponse.__repr__  s4    F>>..++ 77J
 
 	
r!   c                 F    t        d| j                  j                  z        )NzMThis %s instance has no `content` attribute. Use `streaming_content` instead.AttributeErrorr   rI   rd   s    r   r   zStreamingHttpResponse.content  s'    +-1^^-D-DE
 	
r!   c                 F    t        d| j                  j                  z        )Nz)This %s instance has no `text` attribute.r   rd   s    r   r   zStreamingHttpResponse.text  s!    7$..:Q:QQ
 	
r!   c                       j                   r j                   fd} |       S t         j                   j                        S )Nc                 T   K   2 3 d {   } j                  |        7 6 y wr9   r   )part	_iteratorr   s    r   awrapperz9StreamingHttpResponse.streaming_content.<locals>.awrapper  s(     "+ 0$//$//0)s   (&$&(&()is_asyncr  mapr   )r   r  r  s   ` @r   r   z'StreamingHttpResponse.streaming_content  s9    == I0 :t77r!   c                 &    | j                  |       y r9   )_set_streaming_contentrg   s     r   r   z'StreamingHttpResponse.streaming_content  s    ##E*r!   c                     	 t        |      | _        d| _        t        |d      r&| j                  j                  |j                         y y # t        $ r t	        |      | _        d| _        Y Uw xY w)NFTr   )	r   r  r  r^   aiterr   rX   r   r   rg   s     r   r  z,StreamingHttpResponse._set_streaming_content  se    	!!%[DN!DM 5'"""))%++6 #  	!"5\DN DM	!s   A  A/.A/c           
          	 t        | j                        S # t        $ rZ t        j                  dt
        d       d }t        | j                  t         t        |      | j                                    cY S w xY w)NzStreamingHttpResponse must consume asynchronous iterators in order to serve them synchronously. Use a synchronous iterator instead.   
stacklevelc                 R   K   g }| 2 3 d {   }|j                  |       7 6 |S wr9   )r   )r  as_listr   s      r   to_listz/StreamingHttpResponse.__iter__.<locals>.to_list  s.     #, *%NN5)*9s   '$"$'$')
r   r   r^   warningswarnWarningr  r   r   r  )r   r  s     r   r   zStreamingHttpResponse.__iter__  sp    	V..// 	VMMP	 t-C]7-CDNN-S(TUU	Vs    A A:9A:c                  K   	 | j                   2 3 d {   }| 7 
6 y # t        $ rQ t        j                  dt        d        t        t              | j                          d {  7  D ]  }| 	 Y y w xY ww)NzStreamingHttpResponse must consume synchronous iterators in order to serve them asynchronously. Use an asynchronous iterator instead.r  r  )r   r^   r  r  r  r   list)r   r  s     r   	__aiter__zStreamingHttpResponse.__aiter__  sy     	"44 d
4 
	MMS	 2mD1$2H2HIII
 J
	sJ   B # !!# !# B AA=*A-+A=:B <A==B c                 8    dj                  | j                        S r   )rr   r   rd   s    r   r   zStreamingHttpResponse.getvalue  s    xx..//r!   )rF   )rI   rJ   rK   r   r   r    r   r   r   r   r   r   r  r   r  r   r   r   s   @r   r   r     s     I3
 
 
 
 

 8 8 + +	7V( 0r!   r   c                   >     e Zd ZdZdZddd fd
Z fdZd Z xZS )	FileResponsez>
    A streaming HTTP response class optimized for files.
    i   Frj   )as_attachmentfilenamec                d    || _         || _        d|vxs |d   d u | _        t        |   |i | y )Nr`   )r  r  _no_explicit_content_typer   r    )r   r  r  r   r   r   s        r   r    zFileResponse.__init__(  sE    * &(JF>,Bd,J 	& 	$)&)r!   c                 "    t        |d      sd  _        t           |      S |x _        t        d      r% j                  j                  j                         t         fdd      } j                         t           |       y )Nreadr   c                  :     j                  j                        S r9   )r   
block_sizefileliker   s   r   <lambda>z5FileResponse._set_streaming_content.<locals>.<lambda>8  s    X]]4??;r!   r!   )	r   file_to_streamr   r  rX   r   r   r   set_headers)r   r   r$  r   s   ` @r   r  z#FileResponse._set_streaming_content0  s|    uf%"&D71%88)..h8W%""))(..9;SA"&u-r!   c                     t        dd      }t        |t              r|nd}t        d      xr t        d       xs j	                         }t        d      r|rcj                         }j                  dt        j                         j                         |z
   j                  d<   j                  |       nt        d      r9j                         j                  j                         z
   j                  d<   nt        j                  j                  |      rt        j                  j                  |      j                         z
   j                  d<   n_|r]t!        t#         fd	d             j                  d<   j                  t%         j                  d          t        j                         t        j                  j'                   j(                  xs |      } j*                  rU|rDt-        j.                  |      \  }}d
dddddj1                  ||      }|xs d j                  d<   nd j                  d<   t3         j4                  |      x}r| j                  d<   yy)z
        Set some common response headers (Content-Length, Content-Type, and
        Content-Disposition) based on the `filelike` response content.
        namerj   seekr   r   r   zContent-Length	getbufferc                  L    t         j                  j                              S r9   )r   r   r"  r#  s   r   r%  z*FileResponse.set_headers.<locals>.<lambda>V  s    St!?@r!   zapplication/x-brotlizapplication/x-bzipzapplication/x-compresszapplication/gzipzapplication/x-xz)brbzip2compressgzipxzzapplication/octet-streamrS   zContent-DispositionN)getattrr*   r+   r   r   r   r*  ioSEEK_ENDrU   r+  nbytesosr   existsgetsizesumr   r\   basenamer  r  	mimetypes
guess_typerc   r   r  )r   r$  r  r   initial_positionr`   encodingcontent_dispositions   ``      r   r'  zFileResponse.set_headers<  s+   
 8VR0)(C88b8V, 
*--D1B1B1D 	 8V$#+==? a-19CS1S-../;/&&(//(--/A -. )GGOOH-? -. -0@!D.DLL)* MM3t||,<=>>L77##DMM$=X>)))2)=)=h)G&h 11 8.,  #h-  !>$> ^, 0J^,"<#
 
 
 3FDLL./
r!   )	rI   rJ   rK   r   r"  r    r  r'  r   r   s   @r   r  r  !  s$     J,1B *
.4Fr!   r  c                   @     e Zd Zg dZd fd	Z ed       Zd Z xZS )HttpResponseRedirectBase)httphttpsftpc                 V   t        |   |i | t        |      | d<   t        |      }t	        |      t
        kD  rt        dt
         d      t        |      }|r| j                  | _	        |j                  r1|j                  | j                  vrt        d|j                  z        y y )NLocationzUnsafe redirect exceeding z charactersz)Unsafe redirect to URL with protocol '%s')r   r    r   r+   r   r   r   r   status_code_preserve_requestr]   schemeallowed_schemes)r   redirect_topreserve_requestr   r   redirect_to_strparsedr   s          r   r    z!HttpResponseRedirectBase.__init__v  s    $)&)%k2Zk*.0$,^,<KH  /*#@@D==V]]$2F2FF$;fmmK  G=r!   c                     | d   S )NrF  rF   rd   s    r   r%  z!HttpResponseRedirectBase.<lambda>  s	    Z 0r!   c                 z    d| j                   j                  | j                  | j                  | j                  dz  S )NzD<%(cls)s status_code=%(status_code)d%(content_type)s, url="%(url)s">)r   r]   r`   url)r   rI   r]   rw   rP  rd   s    r   r   z!HttpResponseRedirectBase.__repr__  s:    R~~..#// $ ; ;xx		
r!   rH   )	rI   rJ   rK   rI  r    r   rP  r   r   r   s   @r   rA  rA  s  s    .O  0
1C	
r!   rA  c                       e Zd ZdZdZy)HttpResponseRedirecti.  i3  NrI   rJ   rK   r]   rG  rF   r!   r   rR  rR        K#& r!   rR  c                       e Zd ZdZdZy)HttpResponsePermanentRedirecti-  i4  NrS  rF   r!   r   rV  rV    rT  r!   rV  c                   Z     e Zd ZdZ fdZej                  j                  d        Z xZS )HttpResponseNotModifiedi0  c                 *    t        |   |i | | d= y )Nzcontent-type)r   r    )r   r   r   r   s      r   r    z HttpResponseNotModified.__init__  s    $)&) r!   c                 ,    |rt        d      g | _        y )Nz7You cannot set content to a 304 (Not Modified) response)r   r   rg   s     r   r   zHttpResponseNotModified.content  s     I  r!   )	rI   rJ   rK   r]   r    r   r   r   r   r   s   @r   rX  rX    s-    K!    !r!   rX  c                       e Zd ZdZy)HttpResponseBadRequesti  NrI   rJ   rK   r]   rF   r!   r   r\  r\        Kr!   r\  c                       e Zd ZdZy)HttpResponseNotFoundi  Nr]  rF   r!   r   r`  r`    r^  r!   r`  c                       e Zd ZdZy)HttpResponseForbiddeni  Nr]  rF   r!   r   rb  rb    r^  r!   rb  c                   (     e Zd ZdZ fdZd Z xZS )HttpResponseNotAllowedi  c                 L    t        |   |i | dj                  |      | d<   y )Nz, Allow)r   r    rr   )r   permitted_methodsr   r   r   s       r   r    zHttpResponseNotAllowed.__init__  s(    $)&)		"34Wr!   c                 l    d| j                   j                  | j                  | j                  | d   dz  S )NzC<%(cls)s [%(methods)s] status_code=%(status_code)d%(content_type)s>rf  )r   r]   r`   methodsr   rd   s    r   r   zHttpResponseNotAllowed.__repr__  s;    T>>**++ 77G}	X
 
 	
r!   )rI   rJ   rK   r]   r    r   r   r   s   @r   rd  rd    s    K5
r!   rd  c                       e Zd ZdZy)HttpResponseGonei  Nr]  rF   r!   r   rk  rk    r^  r!   rk  c                       e Zd ZdZy)HttpResponseServerErrori  Nr]  rF   r!   r   rm  rm    r^  r!   rm  c                       e Zd Zy)Http404NrM   rF   r!   r   ro  ro    rN   r!   ro  c                   *     e Zd ZdZeddf fd	Z xZS )JsonResponseaH  
    An HTTP response class that consumes data to be serialized to JSON.

    :param data: Data to be dumped into json. By default only ``dict`` objects
      are allowed to be passed due to a security flaw before ECMAScript 5. See
      the ``safe`` parameter for more information.
    :param encoder: Should be a json encoder class. Defaults to
      ``django.core.serializers.json.DjangoJSONEncoder``.
    :param safe: Controls if only ``dict`` objects may be serialized. Defaults
      to ``True``.
    :param json_dumps_params: A dictionary of kwargs passed to json.dumps().
    TNc                     |rt        |t              st        d      |i }|j                  dd       t	        j
                  |fd|i|}t        |   dd|i| y )NzTIn order to allow non-dict objects to be serialized set the safe parameter to False.r`   zapplication/jsonr   r   rF   )r*   dictr^   rG   jsondumpsr   r    )r   r   encodersafejson_dumps_paramsr   r   s         r   r    zJsonResponse.__init__  sp     
4.+  $ ".*<=zz$AGA/@A000r!   )rI   rJ   rK   r   r   r    r   r   s   @r   rq  rq    s      "1 1r!   rq  )Ar   r3  rt  r;  r6  rer1   r   r  email.headerr   http.clientr   urllib.parser   asgiref.syncr   r   django.confr   django.corer	   r
   django.core.exceptionsr   django.core.serializers.jsonr   django.http.cookier   django.utilsr   django.utils.datastructuresr   django.utils.encodingr   django.utils.functionalr   django.utils.httpr   r   r   django.utils.regex_helperr   Irk   r   rW   r/   rP   r   r   r  rA  rR  rV  rX  r\  r`  rb  rd  rk  rm  r   ro  rq  rF   r!   r   <module>r     sR    	   	 	 
    ! ! 5   ( 5 : + ! > , 3 S S 6 0'! 
?, ?D	Z 	CT CTLF# FRh0, h0VOF( OFd
| 
B'3 '
'$< '
l  \ < L 
\ 
 | l 	i 	1< 1r!   