
    MȂi                     @    S SK r S SKJr  S SKJr  S SKJr  0 rS rS r	g)    N)wraps)iscoroutinefunction)HttpRequestc                  n   ^  [        T 5      S:X  a  [        T S   5      (       a  [        S5      eU 4S jnU$ )aJ  
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                   >^ ^ [        T 5      (       a  T mT n[        USS 5      b  UR                  n[        USS 5      b  M   [        R                  " U5      nUR
                  R                  n[        U SU 35      nT(       a  T[        U'   T$ S[        U'    T$ [        T 5      U UU4S j5       mT$ ! [         a    [        T R                   S35      ef = f)N__wrapped__:z cannot safely be wrapped by @sensitive_variables, make it either non-async or defined in a Python file (not a builtin or from a native extension).__ALL__c                  @   > T(       a  TTl         OSTl         T" U 0 UD6$ )Nr   )sensitive_variables)	func_argsfunc_kwargsfuncsensitive_variables_wrapper	variabless     ND:\sksbv-state-backend\venv\Lib\site-packages\django/views/decorators/debug.pyr   Ksensitive_variables.<locals>.decorator.<locals>.sensitive_variables_wrapperE   s(    FO/CFO/CY6+66    )r   getattrr	   inspectgetfile__code__co_firstlinenohash	TypeError
ValueError__name__*coroutine_functions_to_sensitive_variablesr   )r   wrapped_func	file_pathfirst_line_numberkeyr   r   s   `    @r   	decorator&sensitive_variables.<locals>.decorator(   s   t$$*.'L,t<H+77 ,t<H?#OOL9	 %1$9$9$H$H!i[*;)<=>BK:3? +* CL:3? +* 4[7 7 +*7   }}o &N N s   B5 5#Clencallabler   )r   r$   s   ` r   r   r      s@    . 9~x	!55J
 	

%+N r   c                  n   ^  [        T 5      S:X  a  [        T S   5      (       a  [        S5      eU 4S jnU$ )aK  
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   zsensitive_post_parameters() must be called to use it as a decorator, e.g., use @sensitive_post_parameters(), not @sensitive_post_parameters.c                    >^  [        T 5      (       a  [        T 5      UU 4S j5       nU$ [        T 5      UU 4S j5       nU$ )Nc                    >#    [        U [        5      (       d  [        S5      eT(       a  TU l        OSU l        T" U /UQ70 UD6I S h  vN $  N7fNzsensitive_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views      r   !sensitive_post_parameters_wrapperWsensitive_post_parameters.<locals>.decorator.<locals>.sensitive_post_parameters_wrappers   sU     !';77#- 
 8BG58AG5!';D;F;;;;s   AA	A
Ac                    > [        U [        5      (       d  [        S5      eT(       a  TU l        OSU l        T" U /UQ70 UD6$ r,   r-   r0   s      r   r6   r7      sL    !';77#- 
 8BG58AG5G5d5f55r   )r   r   )r5   r6   r4   s   ` r   r$   ,sensitive_post_parameters.<locals>.decoratorp   sL    t$$4[< <: 10 4[6 6 10r   r&   )r4   r$   s   ` r   r/   r/   R   s?    . :!A 7 7*
 	
!1F r   )
r   	functoolsr   asgiref.syncr   django.httpr   r   r   r/    r   r   <module>r>      s$      , #-/ *DNAr   