Skip to content

Commit

Permalink
Merge pull request #28 from edx/fix-decorator-name
Browse files Browse the repository at this point in the history
Use functools.wraps to prevent the decorator from swallowing the view name
  • Loading branch information
christopappas authored Sep 12, 2019
2 parents 05535d4 + 9287fa5 commit ff91b93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Change Log

.. There should always be an "Unreleased" section for changes pending release.
[1.0.3] - 2019-09-12
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Use functools.wraps to prevent the decorator from swallowing the view name

[1.0.2] - 2019-07-12
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion edx_rbac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import, unicode_literals

__version__ = '1.0.2'
__version__ = '1.0.3'

default_app_config = 'edx_rbac.apps.EdxRbacConfig' # pylint: disable=invalid-name
3 changes: 3 additions & 0 deletions edx_rbac/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""
from __future__ import absolute_import, unicode_literals

import functools

import crum


Expand All @@ -16,6 +18,7 @@ def permission_required(*permissions, **decorator_kwargs):
"""
def decorator(view):
"""Verify permissions decorator."""
@functools.wraps(view)
def wrapped_view(self, request, *args, **kwargs):
"""Wrap for the view function."""
fn = decorator_kwargs.get('fn', None)
Expand Down

0 comments on commit ff91b93

Please sign in to comment.