fix view module name using wraps in the decorator
This commit is contained in:
parent
8996d4b323
commit
702c9cda2c
2 changed files with 4 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import HttpResponseForbidden
|
from django.http import HttpResponseForbidden
|
||||||
|
|
||||||
|
@ -7,6 +9,7 @@ from issue.models import Project
|
||||||
def project_perm_required(perm):
|
def project_perm_required(perm):
|
||||||
|
|
||||||
def decorator(view):
|
def decorator(view):
|
||||||
|
@wraps(view)
|
||||||
def wrapper(request, *args, **kwargs):
|
def wrapper(request, *args, **kwargs):
|
||||||
if len(args) > 0 and isinstance(args[0], Project):
|
if len(args) > 0 and isinstance(args[0], Project):
|
||||||
project = args[0]
|
project = args[0]
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ProjectMiddleware:
|
||||||
|
|
||||||
def process_view(self, request, view, view_args, view_kwargs):
|
def process_view(self, request, view, view_args, view_kwargs):
|
||||||
|
|
||||||
if view.__module__.split('.')[0] != 'issue':
|
if view.__module__ != 'issue.views':
|
||||||
return
|
return
|
||||||
|
|
||||||
if not hasattr(request, 'user'):
|
if not hasattr(request, 'user'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue