Skip to content

Commit

Permalink
fixup! 🛂(backend) use playlist token in apis
Browse files Browse the repository at this point in the history
  • Loading branch information
kernicPanel committed Aug 22, 2023
1 parent ef5f356 commit 66895ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/backend/marsha/core/simple_jwt/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import uuid

from django.conf import settings
from rest_framework_simplejwt.exceptions import TokenError

import factory
from faker.utils.text import slugify
from rest_framework_simplejwt.exceptions import TokenError

from marsha.core.factories import (
ConsumerSiteFactory,
Expand Down Expand Up @@ -141,13 +141,13 @@ class BaseResourceTokenFactory(BaseTokenFactory):
"""

@staticmethod
def get_playlist_id(o):
"""Get the playlist id from the resource."""
def get_playlist_id(params):
"""Ensure the resource is a playlist."""
resource_id = uuid.uuid4()
if not o.resource:
if not params.resource:
pass
elif isinstance(o.resource, Playlist):
resource_id = o.resource.id
elif isinstance(params.resource, Playlist):
resource_id = params.resource.id
else:
raise TokenError("resource is not a playlist")

Expand Down

0 comments on commit 66895ba

Please sign in to comment.