
    Evg;$                         d dl Z d dlmZmZ d dlmZ d dlmZmZm	Z	m
Z
mZ d dlmZ d dlmZ d dlmZ d dlmZ  e j        d	          Z G d
 d          Z G d d          Z G d d          Z G d deee          Z G d de          ZdS )    N)iscoroutinefunctionmarkcoroutinefunction)ImproperlyConfigured)HttpResponseHttpResponseGoneHttpResponseNotAllowedHttpResponsePermanentRedirectHttpResponseRedirect)TemplateResponse)reverse)classonlymethod)classpropertyzdjango.requestc                       e Zd ZdZdZd ZdS )ContextMixinz
    A default context mixin that passes the keyword arguments received by
    get_context_data() as the template context.
    Nc                 t    |                     d|            | j        |                    | j                   |S )Nview)
setdefaultextra_contextupdate)selfkwargss     V/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/django/views/generic/base.pyget_context_datazContextMixin.get_context_data   s;    &$''')MM$,---    )__name__
__module____qualname____doc__r   r    r   r   r   r      s4         
 M    r   r   c                   j    e Zd ZdZg dZd Zed             Zed             Z	d Z
d Zd Zd	 Zd
 ZdS )Viewz}
    Intentionally simple parent class for all views. Only implements
    dispatch-by-method and simple sanity checking.
    )getpostputpatchdeleteheadoptionstracec                 \    |                                 D ]\  }}t          | ||           dS )z|
        Constructor. Called in the URLconf; can contain helpful extra
        keyword arguments, and other things.
        N)itemssetattr)r   r   keyvalues       r   __init__zView.__init__5   s>     !,,.. 	& 	&JCD#u%%%%	& 	&r   c                       fd j         D             }|sdS t          |d                   t          fd|dd          D                       st           j         d          S )Nc                 \    g | ](}|d k    t          |          t          |          )S )r(   )hasattrgetattr).0methodclss     r   
<listcomp>z&View.view_is_async.<locals>.<listcomp>A   sG     
 
 
)##V(<(<# C  ###r   Fr   c              3   >   K   | ]}t          |          k    V  d S N)r   )r4   his_asyncs     r   	<genexpr>z%View.view_is_async.<locals>.<genexpr>I   s1      LL!&q))X5LLLLLLr      z4 HTTP handlers must either be all sync or all async.)http_method_namesr   allr   r   )r6   handlersr;   s   ` @r   view_is_asynczView.view_is_async?   s    
 
 
 
/
 
 

  	5&x{33LLLLx|LLLLL 	&#      r   c                     D ]P}| j         v rt          d|d j        d          t           |          st           j        d|d          Q fd} |_        |_         j        |_         j        |_         j        j	        |_	        |j
                             j        j
                    j        rt          |           |S )z0Main entry point for a request-response process.zThe method name z* is not accepted as a keyword argument to z().z() received an invalid keyword zJ. as_view only accepts arguments that are already attributes of the class.c                      di } |j         | g|R i | t          |d          st          dj        z             |j        | g|R i |S )Nrequestz\%s instance has no 'request' attribute. Did you override setup() and forget to call super()?r   )setupr2   AttributeErrorr   dispatch)rD   argsr   r   r6   
initkwargss       r   r   zView.as_view.<locals>.view`   s    3$$$$DDJw00000004++ $:<?LI   !4=:4:::6:::r   )r>   	TypeErrorr   r2   
view_classview_initkwargsr   r   rG   __annotations____dict__r   rA   r   )r6   rI   r-   r   s   ``  r   as_viewzView.as_viewP   s     	 	Cc+++i"%##s|||5   3$$  36,,,E  	; 	; 	; 	; 	; 	; )
 {."|; 	S\2333  	(!$'''r   c                     t          | d          rt          | d          s| j        | _        || _        || _        || _        dS )z1Initialize attributes shared by all view methods.r"   r'   N)r2   r"   r'   rD   rH   r   r   rD   rH   r   s       r   rE   z
View.setup}   sG    4 	!f(=(= 	!DI	r   c                     |j                                         | j        v r.t          | |j                                         | j                  }n| j        } ||g|R i |S r9   )r5   lowerr>   r3   http_method_not_allowed)r   rD   rH   r   handlers        r   rG   zView.dispatch   ss     >!!T%;;;gn**,,d.J GG 2Gww0000000r   c                     t                               d|j        |j        d|d           t	          |                                           | j        rfd} |            S S )NzMethod Not Allowed (%s): %si  status_coderD   extrac                     K    S r9   r   responses   r   funcz*View.http_method_not_allowed.<locals>.func         r   )loggerwarningr5   pathr   _allowed_methodsrA   r   rD   rH   r   r^   r]   s        @r   rT   zView.http_method_not_allowed   s    )NL"%'::	 	 	
 	
 	
 *$*?*?*A*ABB 	          466MOr   c                     t                      d                    |                                           j        d<   dj        d<   | j        rfd} |            S S )z8Handle responding to requests for the OPTIONS HTTP verb.z, Allow0zContent-Lengthc                     K    S r9   r   r\   s   r   r^   zView.options.<locals>.func   r_   r   )r   joinrc   headersrA   rd   s        @r   r(   zView.options   su    >>$(IId.C.C.E.E$F$F!-0)* 	          466MOr   c                 *      fd j         D             S )Nc                 X    g | ]&}t          |          |                                'S r   )r2   upper)r4   mr   s     r   r7   z)View._allowed_methods.<locals>.<listcomp>   s0    NNNaWT1=M=MN		NNNr   )r>   r   s   `r   rc   zView._allowed_methods   s     NNNN4#9NNNNr   N)r   r   r   r   r>   r/   r   rA   r   rO   rE   rG   rT   r(   rc   r   r   r   r!   r!   $   s         
	 	 	& & &   ]  * * _*X  
1 
1 
1  $  O O O O Or   r!   c                   .    e Zd ZdZdZdZeZdZd Z	d Z
dS )TemplateResponseMixinz.A mixin that can be used to render a template.Nc                     |                     d| j                    | j        d| j        |                                 || j        d|S )z
        Return a response, using the `response_class` for this view, with a
        template rendered with the given context.

        Pass response_kwargs to the constructor of the response class.
        content_type)rD   templatecontextusingr   )r   rs   response_classrD   get_template_namestemplate_engine)r   ru   response_kwargss      r   render_to_responsez(TemplateResponseMixin.render_to_response   se     	"">43DEEE"t" 
L,,..&	
 

 
 
 	
r   c                 >    | j         t          d          | j         gS )z
        Return a list of template names to be used for the request. Must return
        a list. May not be called if render_to_response() is overridden.
        NztTemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()')template_namer   ro   s    r   rx   z(TemplateResponseMixin.get_template_names   s3    
 %&Q  
 &''r   )r   r   r   r   r}   ry   r   rw   rs   r{   rx   r   r   r   rq   rq      sL        88MO%NL
 
 
 ( ( ( ( (r   rq   c                       e Zd ZdZd ZdS )TemplateViewzT
    Render a template. Pass keyword arguments from the URLconf to the context.
    c                 F     | j         di |}|                     |          S )Nr   )r   r{   )r   rD   rH   r   ru   s        r   r"   zTemplateView.get   s.    '$'11&11&&w///r   N)r   r   r   r   r"   r   r   r   r   r      s-         0 0 0 0 0r   r   c                   R    e Zd ZdZdZdZdZdZd Zd Z	d Z
d Zd Zd	 Zd
 Zd ZdS )RedirectViewz&Provide a redirect on any GET request.FNc                     | j         r| j         |z  }n!| j        rt          | j        ||          }ndS | j        j                            dd          }|r| j        r|d|}|S )z
        Return the URL redirect to. Keyword arguments from the URL pattern
        match generating the redirect request are provided as kwargs to this
        method.
        )rH   r   NQUERY_STRING ?)urlpattern_namer   rD   METAr"   query_string)r   rH   r   r   s       r   get_redirect_urlzRedirectView.get_redirect_url   s     8 	(V#CC 	$+$vFFFCC4| $$^R88 	(D% 	( SS$$'C
r   c                      | j         |i |}|r%| j        rt          |          S t          |          S t                              d|j        d|d           t                      S )NzGone: %si  rW   rY   )r   	permanentr	   r
   r`   ra   rb   r   )r   rD   rH   r   r   s        r   r"   zRedirectView.get   s    #d#T4V44 		&~ 14S999+C000NNGLPW0X0X     $%%%r   c                 $     | j         |g|R i |S r9   r"   rQ   s       r   r'   zRedirectView.head  $    tx1$111&111r   c                 $     | j         |g|R i |S r9   r   rQ   s       r   r#   zRedirectView.post  r   r   c                 $     | j         |g|R i |S r9   r   rQ   s       r   r(   zRedirectView.options  r   r   c                 $     | j         |g|R i |S r9   r   rQ   s       r   r&   zRedirectView.delete  r   r   c                 $     | j         |g|R i |S r9   r   rQ   s       r   r$   zRedirectView.put  r   r   c                 $     | j         |g|R i |S r9   r   rQ   s       r   r%   zRedirectView.patch  r   r   )r   r   r   r   r   r   r   r   r   r"   r'   r#   r(   r&   r$   r%   r   r   r   r   r      s        00I
CLL  $& & &2 2 22 2 22 2 22 2 22 2 22 2 2 2 2r   r   )loggingasgiref.syncr   r   django.core.exceptionsr   django.httpr   r   r   r	   r
   django.template.responser   django.urlsr   django.utils.decoratorsr   django.utils.functionalr   	getLoggerr`   r   r!   rq   r   r   r   r   r   <module>r      s    C C C C C C C C 7 7 7 7 7 7              6 5 5 5 5 5       3 3 3 3 3 3 1 1 1 1 1 1		+	,	,       OO OO OO OO OO OO OO OOd#( #( #( #( #( #( #( #(L0 0 0 0 0(, 0 0 072 72 72 72 724 72 72 72 72 72r   