mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-28 16:38:17 +00:00
decorate wrapper functions with functools.wraps
This commit is contained in:
parent
a8e7200b1a
commit
8c583e68d8
1 changed files with 4 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from functools import wraps
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
from django.core.mail import send_mail as django_send_mail
|
||||
from django.conf import settings
|
||||
|
|
@ -84,6 +86,7 @@ def permission_required(permission_name):
|
|||
# decorator takes the view function, and returns the view wrapped in
|
||||
# a permission check
|
||||
|
||||
@wraps(view_func)
|
||||
def wrapped_view_func(request, *args, **kwargs):
|
||||
if request.user.has_perm(permission_name):
|
||||
# permission check succeeds; run the view function as normal
|
||||
|
|
@ -108,6 +111,7 @@ def any_permission_required(*perms):
|
|||
# decorator takes the view function, and returns the view wrapped in
|
||||
# a permission check
|
||||
|
||||
@wraps(view_func)
|
||||
def wrapped_view_func(request, *args, **kwargs):
|
||||
for perm in perms:
|
||||
if request.user.has_perm(perm):
|
||||
|
|
|
|||
Loading…
Reference in a new issue