|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /lib64/python2.7/site-packages/django/utils/ |
Upload File : |
�
r�\c @ sy d Z d d l m Z m Z m Z d d l m Z d e f d � � YZ d � Z d � Z
d � Z d � Z d
� Z
d S( sC Functions that help with dynamically creating decorators for views.i����( t wrapst update_wrappert WRAPPER_ASSIGNMENTS( t sixt classonlymethodc B s e Z d � Z RS( c C s4 | d k r t d � � n t t | � j | | � S( Ns0 This method is available only on the view class.( t Nonet AttributeErrort superR t __get__( t selft instancet owner( ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyR s ( t __name__t
__module__R ( ( ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyR s c s0 � f d � } t | � � d � j | _ | S( s?
Converts a function decorator into a method decorator
c s? � � f d � } � d � � } t | | � t | � � | S( Nc s% � � � f d � � } | | | � S( Nc s � � | | � S( N( ( t args2t kwargs2( t funcR ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt
bound_func s ( ( R t argst kwargsR ( t decoratorR ( R s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt _wrapper s c _ s d S( N( ( R R ( ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt dummy! s ( R ( R R R ( R ( R s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt _dec s
s method_decorator(%s)( R R ( R R ( ( R s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt method_decorator s
c C s
t | � S( s=
Like decorator_from_middleware, but returns a function
that accepts the arguments to be passed to the middleware_class.
Use like::
cache_page = decorator_from_middleware_with_args(CacheMiddleware)
# ...
@cache_page(3600)
def my_view(request):
# ...
( t make_middleware_decorator( t middleware_class( ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt# decorator_from_middleware_with_args/ s
c C s
t | � � S( s�
Given a middleware class (not an instance), returns a view decorator. This
lets you use middleware functionality on a per-view basis. The middleware
is created with no params passed.
( R ( R ( ( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt decorator_from_middleware? s c s+ t j r
t St � f d � t D� � Sd S( s�
Return the list of functools-wrappable attributes on a callable.
This is required as a workaround for http://bugs.python.org/issue3445
under Python 2.
c 3 s$ | ] } t � | � r | Vq d S( N( t hasattr( t .0t a( t fn( s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pys <genexpr>Q s N( R t PY3R t tuple( R ( ( R s9 /tmp/pip-install-XxeQeY/django/django/utils/decorators.pyt available_attrsH s c s � f d � } | S( Nc s"