-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Update tastypie #4325
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
Update tastypie #4325
Conversation
@@ -12,7 +12,7 @@ | |||
from django.core.cache import cache | |||
from django.shortcuts import get_object_or_404 | |||
from tastypie import fields | |||
from tastypie.authorization import DjangoAuthorization | |||
from tastypie.authorization import DjangoAuthorization, ReadOnlyAuthorization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other resources using DjangoAuthorization
, but tests were failing only for the ProjectResource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't have tests for the other resources, that's why
@@ -39,7 +39,7 @@ class Meta(object): | |||
allowed_methods = ['get', 'post', 'put'] | |||
queryset = Project.objects.api() | |||
authentication = PostAuthentication() | |||
authorization = DjangoAuthorization() | |||
authorization = ReadOnlyAuthorization() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authorization is already default to ReadOnlyAuthorization
, I'm just being explicit here.
def test_make_project(self): | ||
"""Test that a superuser can use the API.""" | ||
def test_cant_make_project(self): | ||
"""Test that a can't use the API to create projects.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We aren't using this in our code, I'm not sure if we allow this in the external API, we don't have that documented either https://docs.readthedocs.io/en/latest/api/v1.html
Ok, this is weird, tests are passing for 2d59d29 on travis, but locally (I just checked again!) are falling. Anyone else can check that? (yes, I'm running my tests with |
This looks tied to a version |
b769b3a
to
bef0670
Compare
b344168
to
400859f
Compare
Last time I check #4325 (comment) tests were passing locally btw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and I think we can update this independently of the Django upgrade. We never documented the API for creating projects so I'm +1 on just removing it.
requirements/pip.txt
Outdated
@@ -15,7 +15,7 @@ six==1.11.0 | |||
future==0.16.0 | |||
|
|||
# django-tastypie 0.13.x and 0.14.0 are not compatible with our code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update this comment. From the tastypie changelog, it looks like 0.13.3 is still compatible with Django 1.9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bfeb5e7
to
58b452b
Compare
I have updated tastypie to 0.13.3 and rebased, tests should pass (hope p:) |
I ran a manual test against the endpoints in the v1 API docs and they looked ok to me. The only exception was the File Search API which doesn't actually appear to be implemented correctly. This wasn't an issue with this PR though. It isn't working in production or with the old tastypie. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@stsewd @davidfischer Is there anything missing or blocking this PR to be merged? It has the label "Work in progress" but I think it's completed and ready to merge. Also, the milestone is set to 3.0. Not sure why... We can upgrade to 0.14.0 once we upgrade Django to 1.11 in another PR. |
This is included in #4750 but I believe it could be merged anytime. The Django 1.11 upgrade relies on this but this can be merged and used with our current setup. |
Ref to #4319 (comment) and #3570 (comment)
Closes #3570