Loading django/utils/decorators.py +10 −2 Original line number Diff line number Diff line Loading @@ -2,12 +2,16 @@ from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS from django.utils import six class classonlymethod(classmethod): def __get__(self, instance, owner): if instance is not None: raise AttributeError("This method is available only on the view class.") return super(classonlymethod, self).__get__(instance, owner) def method_decorator(decorator): """ Converts a function decorator into a method decorator Loading Loading @@ -68,8 +72,12 @@ def decorator_from_middleware(middleware_class): def available_attrs(fn): """ Return the list of functools-wrappable attributes on a callable. This is required as a workaround for http://bugs.python.org/issue3445. This is required as a workaround for http://bugs.python.org/issue3445 under Python 2. """ if six.PY3: return WRAPPER_ASSIGNMENTS else: return tuple(a for a in WRAPPER_ASSIGNMENTS if hasattr(fn, a)) Loading Loading
django/utils/decorators.py +10 −2 Original line number Diff line number Diff line Loading @@ -2,12 +2,16 @@ from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS from django.utils import six class classonlymethod(classmethod): def __get__(self, instance, owner): if instance is not None: raise AttributeError("This method is available only on the view class.") return super(classonlymethod, self).__get__(instance, owner) def method_decorator(decorator): """ Converts a function decorator into a method decorator Loading Loading @@ -68,8 +72,12 @@ def decorator_from_middleware(middleware_class): def available_attrs(fn): """ Return the list of functools-wrappable attributes on a callable. This is required as a workaround for http://bugs.python.org/issue3445. This is required as a workaround for http://bugs.python.org/issue3445 under Python 2. """ if six.PY3: return WRAPPER_ASSIGNMENTS else: return tuple(a for a in WRAPPER_ASSIGNMENTS if hasattr(fn, a)) Loading