When run the django.core.urlresolvers.resolve ( '/')
to the @api_view decorated function, ResolverMatch.func_name has been set a invalid dotted name
#4462
Labels
Milestone
Checklist
master
branch of Django REST framework.Steps to reproduce
When run the
django.core.urlresolvers.resolve ( '/')
to the @api_view decorated function, ResolverMatch.func_name has been set a invalid dotted name.This is example code.
proj/urls.py::
proj/views.py::
When I run the
django.core.urlresolvers.resolve('/')
, ResolverMatch.func_name has been set a invalid dotted name.The module is set to the dotted name that to module defined it.
But @api_view decorated view function's module has been set
rest_framework.decorators
.Because @api_view decorated view function is
WrappedAPIView
,and
WrappedAPIView
generated in therest_framework.decorators
.https://github.com/tomchristie/django-rest-framework/blob/07efbdb45e5c7ef70249e985b3c1ef1cead455ba/rest_framework/decorators.py#L27-L31
ResolveMatch.view_name has been using it, so set invalid dotted name to ResolveMatch.view_name.
This issue has occrred because of the WrappedAPIView.name has been overwritten and WrappedAPIView.module has not been overwritten.
https://github.com/tomchristie/django-rest-framework/blob/07efbdb45e5c7ef70249e985b3c1ef1cead455ba/rest_framework/decorators.py#L57
The following results are obtained if overwriting module.
The text was updated successfully, but these errors were encountered: