
    P}bg)                        d dl 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  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)ImproperlyConfigured)HttpResponseHttpResponseGoneHttpResponseNotAllowedHttpResponsePermanentRedirectHttpResponseRedirect)TemplateResponse)reverse)classonlymethodz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     l/home/e360mart.nyusoft.in/public_html/e360mart_env/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                   T    e Zd ZdZg dZ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__%   s>     !,,.. 	& 	&JCD#u%%%%	& 	&r   c                 r    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
                   |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   )setuphasattrAttributeErrorr   dispatch)r/   argsr   r   cls
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   )http_method_names	TypeErrorr   r1   
view_classview_initkwargsr   r   r3   __annotations____dict__r   )r5   r6   r*   r   s   ``  r   as_viewzView.as_view/   s     		R 		RCc+++i"%##s|||5   3$$ R>AlllCCC!Q R R RR
	; 	; 	; 	; 	; 	; )
 {."|; 	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)r1   r   r$   r/   r4   r   r   r/   r4   r   s       r   r0   z
View.setupU   sG    4 	!f(=(= 	!DI	r   c                     |j                                         | j        v r.t          | |j                                         | j                  }n| j        } ||g|R i |S N)methodlowerr7   getattrhttp_method_not_allowed)r   r/   r4   r   handlers        r   r3   zView.dispatch]   sl     >!!T%;;;dGN$8$8$:$:D<XYYGG2Gww0000000r   c                     t                               d|j        |j        d|d           t	          |                                           S )NzMethod Not Allowed (%s): %si  status_coder/   extra)loggerwarningrB   pathr   _allowed_methodsr?   s       r   rE   zView.http_method_not_allowedg   sO    )7>7<"%':: 	 	
 	
 	
 &d&;&;&=&=>>>r   c                     t                      }d                    |                                           |j        d<   d|j        d<   |S )z8Handle responding to requests for the OPTIONS HTTP verb.z, Allow0zContent-Length)r   joinrO   headers)r   r/   r4   r   responses        r   r%   zView.optionsn   sC    >>$(IId.C.C.E.E$F$F!-0)*r   c                 *      fd j         D             S )Nc                 X    g | ]&}t          |          |                                'S r   )r1   upper).0mr   s     r   
<listcomp>z)View._allowed_methods.<locals>.<listcomp>v   s0    NNNaWT1=M=MN		NNNr   )r7   r   s   `r   rO   zView._allowed_methodsu   s     NNNN4#9NNNNr   N)r   r   r   r   r7   r,   r   r=   r0   r3   rE   r%   rO   r   r   r   r   r      s         
 ^]]& & & # # _#J  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)r/   templatecontextusingr   )r   r`   response_classr/   get_template_namestemplate_engine)r   rb   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   r\   s    r   re   z(TemplateResponseMixin.get_template_names   s6    
 %&QR R R &''r   )r   r   r   r   rj   rf   r	   rd   r`   rh   re   r   r   r   r^   r^   y   sL        88MO%NL
 
 
 
( 
( 
( 
( 
(r   r^   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   rh   )r   r/   r4   r   rb   s        r   r   zTemplateView.get   s.    '$'11&11&&w///r   N)r   r   r   r   r   r   r   r   rl   rl      s-         0 0 0 0 0r   rl   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.
        )r4   r   NQUERY_STRING ?)urlpattern_namer
   r/   METAr   query_string)r   r4   r   rt   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  rH   rJ   )rx   	permanentr   r   rL   rM   rN   r   )r   r/   r4   r   rt   s        r   r   zRedirectView.get   s    #d#T4V44 
	&~ 14S999+C000NNGL&)g>>     $%%%r   c                 $     | j         |g|R i |S rA   r   r?   s       r   r$   zRedirectView.head   $    tx1$111&111r   c                 $     | j         |g|R i |S rA   r|   r?   s       r   r    zRedirectView.post   r}   r   c                 $     | j         |g|R i |S rA   r|   r?   s       r   r%   zRedirectView.options   r}   r   c                 $     | j         |g|R i |S rA   r|   r?   s       r   r#   zRedirectView.delete   r}   r   c                 $     | j         |g|R i |S rA   r|   r?   s       r   r!   zRedirectView.put   r}   r   c                 $     | j         |g|R i |S rA   r|   r?   s       r   r"   zRedirectView.patch   r}   r   )r   r   r   r   rz   rt   ru   rw   rx   r   r$   r    r%   r#   r!   r"   r   r   r   ro   ro      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   ro   )loggingdjango.core.exceptionsr   django.httpr   r   r   r   r   django.template.responser	   django.urlsr
   django.utils.decoratorsr   	getLoggerrL   r   r   r^   rl   ro   r   r   r   <module>r      s    7 7 7 7 7 7              6 5 5 5 5 5       3 3 3 3 3 3		+	,	,       YO YO YO YO YO YO YO YOx!( !( !( !( !( !( !( !(H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   