a
    Ê[ÙfE  ã                   @   s,   d dl mZ d dlmZ dd„ Zdd„ ZdS )é    ©Úwraps)ÚHttpRequestc                     s0   t ˆ ƒdkr tˆ d ƒr tdƒ‚‡ fdd„}|S )aŠ  
    Indicate which variables used in the decorated function are sensitive so
    that those variables can later be treated in a special way, for example
    by hiding them when logging unhandled exceptions.

    Accept two forms:

    * with specified variable names:

        @sensitive_variables('user', 'password', 'credit_card')
        def my_function(user):
            password = user.pass_word
            credit_card = user.credit_card_number
            ...

    * without any specified variable names, in which case consider all
      variables are sensitive:

        @sensitive_variables()
        def my_function()
            ...
    é   r   zzsensitive_variables() must be called to use it as a decorator, e.g., use @sensitive_variables(), not @sensitive_variables.c                    s   t ˆ ƒ‡ ‡‡fdd„ƒ‰ˆS )Nc                     s    ˆrˆˆ_ ndˆ_ ˆ | i |¤ŽS )NÚ__ALL__)Úsensitive_variables)Ú	func_argsZfunc_kwargs)ÚfuncÚsensitive_variables_wrapperÚ	variables© úoC:\Users\91910\OneDrive\Desktop\vts_admin_rebuild-master\vts\Lib\site-packages\django/views/decorators/debug.pyr
   $   s    zKsensitive_variables.<locals>.decorator.<locals>.sensitive_variables_wrapperr   )r	   ©r   )r	   r
   r   Ú	decorator#   s    z&sensitive_variables.<locals>.decorator©ÚlenÚcallableÚ	TypeError)r   r   r   r   r   r      s    ÿr   c                     s0   t ˆ ƒdkr tˆ d ƒr tdƒ‚‡ fdd„}|S )a‹  
    Indicate which POST parameters used in the decorated view are sensitive,
    so that those parameters can later be treated in a special way, for example
    by hiding them when logging unhandled exceptions.

    Accept two forms:

    * with specified parameters:

        @sensitive_post_parameters('password', 'credit_card')
        def my_view(request):
            pw = request.POST['password']
            cc = request.POST['credit_card']
            ...

    * without any specified parameters, in which case consider all
      variables are sensitive:

        @sensitive_post_parameters()
        def my_view(request)
            ...
    r   r   zŒsensitive_post_parameters() must be called to use it as a decorator, e.g., use @sensitive_post_parameters(), not @sensitive_post_parameters.c                    s   t ˆ ƒ‡‡ fdd„ƒ}|S )Nc                    s:   t | tƒstdƒ‚ˆ rˆ | _nd| _ˆ| g|¢R i |¤ŽS )Nzˆsensitive_post_parameters didn't receive an HttpRequest object. If you are decorating a classmethod, make sure to use @method_decorator.r   )Ú
isinstancer   r   Úsensitive_post_parameters)ÚrequestÚargsÚkwargs)Ú
parametersÚviewr   r   Ú!sensitive_post_parameters_wrapperP   s    
ÿzWsensitive_post_parameters.<locals>.decorator.<locals>.sensitive_post_parameters_wrapperr   )r   r   ©r   )r   r   r   O   s    z,sensitive_post_parameters.<locals>.decoratorr   )r   r   r   r   r   r   1   s    ÿr   N)Ú	functoolsr   Zdjango.httpr   r   r   r   r   r   r   Ú<module>   s   +