Skip to content
Snippets Groups Projects
Commit d7b407b2 authored by vlorentz's avatar vlorentz
Browse files

Properly wrap view functions in decorators.

So the inner function's module and name are shown by the 'show_urls'
command of 'django_extensions'.
parent b88f8a3f
No related branches found
No related tags found
1 merge request!129Properly wrap view functions in decorators.
......@@ -290,6 +290,7 @@ def api_doc(route, noargs=False, need_params=False, tags=[],
if not noargs:
@api_view(['GET', 'HEAD'])
@wraps(f)
def doc_view(request):
doc_data = get_doc_data(f, route, noargs)
return make_api_response(request, None, doc_data)
......
......@@ -3,6 +3,8 @@
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
import functools
from rest_framework.decorators import api_view
from swh.web.common.urlsindex import UrlsIndex
......@@ -63,6 +65,7 @@ def api_route(url_pattern=None, view_name=None,
# create a DRF view from the wrapped function
@api_view(methods)
@throttling.throttle_scope(throttle_scope)
@functools.wraps(f)
def api_view_f(*args, **kwargs):
return f(*args, **kwargs)
# small hacks for correctly generating API endpoints index doc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment