-
Notifications
You must be signed in to change notification settings - Fork 24
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
Backend playlist token #2372
Backend playlist token #2372
Conversation
ff96f1e
to
57d6714
Compare
2dfb27a
to
fed15ce
Compare
1df045b
to
be26101
Compare
180e85c
to
efe8304
Compare
7f785d8
to
6bab60e
Compare
6bab60e
to
b005e64
Compare
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 don't think my review has too much weight.
219a294
to
dc7204f
Compare
b005e64
to
1565c87
Compare
dc7204f
to
6300736
Compare
1565c87
to
b78ac65
Compare
6300736
to
b7133b4
Compare
f246a3f
to
f30c747
Compare
try: | ||
return models.Playlist.objects.filter(id=playlist_id).exists() and ( | ||
str(view.get_queryset().get(id=view.get_object_pk()).playlist_id) | ||
== playlist_id | ||
) | ||
except (AttributeError, ObjectDoesNotExist): | ||
try: | ||
return models.Playlist.objects.filter(id=playlist_id).exists() and ( | ||
str( | ||
view.get_queryset() | ||
.get(id=view.get_object_pk()) | ||
.video.playlist_id | ||
) | ||
== playlist_id | ||
) | ||
except ObjectDoesNotExist: | ||
return False |
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.
Does it work if you replace with this ?
playlist_exists = models.Playlist.objects.filter(id=playlist_id).exists()
try:
return (
playlist_exists
and view.get_queryset()
.filter(id=view.get_object_pk(), playlist__id=playlist_id)
.exists()
)
except FieldError:
return playlist_exists and (
view.get_queryset()
.filter(id=view.get_object_pk(), video__playlist__id=playlist_id)
.exists()
)
), | ||
).exists() | ||
and request.resource.id == view.get_object_pk() | ||
and models.Playlist.objects.filter(pk=request.resource.id).exists() |
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.
Here you are using pk=
and line 173 you are using id=
. Both are good IMO, we should probably choose the one we use everywhere.
b7133b4
to
c7312ed
Compare
66895ba
to
fba89e9
Compare
a12d4cb
to
9899b51
Compare
fba89e9
to
d8a338d
Compare
9899b51
to
0a8c738
Compare
d8a338d
to
a681cc8
Compare
0a8c738
to
024941a
Compare
a681cc8
to
3dcba1d
Compare
024941a
to
5618e0f
Compare
3dcba1d
to
4e5b7fb
Compare
We want to use playlist token instead of resource ones. See #1342
As we are now using playlist tokens, it has to be allowed on video apis.
As we are now using playlist tokens, it has to be allowed on apis.
As we are now using playlist tokens, it has to be allowed on apis.
As we are now using playlist tokens, it has to be allowed on apis.
As we are now using playlist tokens, it has to be allowed on apis.
When run locally, if the front has been built, this test fails. Overriding the static directory ensures the behavior when it is missing.
4e5b7fb
to
42fcb94
Compare
Purpose
Implementation for #2286
Fixes #1342