-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URLPathVersioning should maybe remove the version_param kwarg from subsequent view dispatch? #3718
Labels
Milestone
Comments
I'd rather fix the AuthToken to accept the extra kwarg. |
Thanks for reporting. |
Seems reasonable. |
xordoquy
added a commit
to linovia/django-rest-framework
that referenced
this issue
Dec 11, 2015
jpadilla
added a commit
that referenced
this issue
Dec 13, 2015
Add extra args/kwargs to authtoken's views (#3718)
This was referenced Mar 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been playing around with getting
URLPathVersioning
working properly, and have discovered what might be a bug, or maybe just undocumented (or obvious and expected) behaviour.urlconf contains:
When testing, with something like:
I get an exception that ultimately ends in:
Investigation shows that the
ObtainAuthToken.post()
method doesn't accept any kwargs, so it's clearly failing because it's getting version passed in by default from the rest of the versionating mechanism.Simplest fix would be to just fix the definition of
ObtainAuthToken.post(self, request, **kwargs)
,but it made me wonder if it'll be an issue for other views that are receiving a somewhat unexpected kwarg, and which is by intent already available to them in
request.version
.If there's no good reason to keep it around after extracting it, would it make sense to clean it from the
view args in
views.APIView
somewhere in the initial pre-dispatch phases, maybe as simple as akwargs.pop(request.versioning_scheme.version_param, None)
(with some checks around it) in the appropriate place?I'm currently subclassing
authtoken.ObtainAuthToken
to do exactly this inpost()
, but I figured it might make sense to raise a a more general issue.The text was updated successfully, but these errors were encountered: