summarylogtreecommitdiffstats
path: root/0000-fix-removed-available_attrs.patch
blob: c925369fc8d08db28502fed49133b27982ee3ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
diff --git a/horizon-20.0.0/horizon/decorators.py b/horizon-20.0.0/horizon/decorators.py
index fa67761..38cca3f 100644
--- a/horizon-20.0.0/horizon/decorators.py
+++ b/horizon-20.0.0/horizon/decorators.py
@@ -21,13 +21,12 @@ General-purpose decorators for use with Horizon.
 """
 import functools
 
-from django.utils.decorators import available_attrs
 from django.utils.translation import ugettext_lazy as _
 
 
 def _current_component(view_func, dashboard=None, panel=None):
     """Sets the currently-active dashboard and/or panel on the request."""
-    @functools.wraps(view_func, assigned=available_attrs(view_func))
+    @functools.wraps(view_func, assigned=functools.WRAPPER_ASSIGNMENTS)
     def dec(request, *args, **kwargs):
         if dashboard:
             request.horizon['dashboard'] = dashboard
@@ -46,7 +45,7 @@ def require_auth(view_func):
     """
     from horizon.exceptions import NotAuthenticated
 
-    @functools.wraps(view_func, assigned=available_attrs(view_func))
+    @functools.wraps(view_func, assigned=functools.WRAPPER_ASSIGNMENTS)
     def dec(request, *args, **kwargs):
         if request.user.is_authenticated:
             return view_func(request, *args, **kwargs)
@@ -77,7 +76,7 @@ def require_perms(view_func, required):
     current_perms = getattr(view_func, '_required_perms', set([]))
     view_func._required_perms = current_perms | set(required)
 
-    @functools.wraps(view_func, assigned=available_attrs(view_func))
+    @functools.wraps(view_func, assigned=functools.WRAPPER_ASSIGNMENTS)
     def dec(request, *args, **kwargs):
         if request.user.is_authenticated:
             if request.user.has_perms(view_func._required_perms):
@@ -103,7 +102,7 @@ def require_component_access(view_func, component):
     """
     from horizon.exceptions import NotAuthorized
 
-    @functools.wraps(view_func, assigned=available_attrs(view_func))
+    @functools.wraps(view_func, assigned=functools.WRAPPER_ASSIGNMENTS)
     def dec(request, *args, **kwargs):
         if not component.can_access({'request': request}):
             raise NotAuthorized(_("You are not authorized to access %s")
diff --git a/horizon-20.0.0/openstack_dashboard/api/rest/utils.py b/horizon-20.0.0/openstack_dashboard/api/rest/utils.py
index a9bc3ea..8073ffa 100644
--- a/horizon-20.0.0/openstack_dashboard/api/rest/utils.py
+++ b/horizon-20.0.0/openstack_dashboard/api/rest/utils.py
@@ -17,7 +17,6 @@ import logging
 
 from django.conf import settings
 from django import http
-from django.utils import decorators
 
 from oslo_serialization import jsonutils
 
@@ -104,7 +103,7 @@ def ajax(authenticated=True, data_required=False,
     def decorator(function, authenticated=authenticated,
                   data_required=data_required):
         @functools.wraps(function,
-                         assigned=decorators.available_attrs(function))
+                         assigned=functools.WRAPPER_ASSIGNMENTS)
         def _wrapped(self, request, *args, **kw):
             if authenticated and not request.user.is_authenticated:
                 return JSONResponse('not logged in', 401)