From 66895bac380393d9cb4ef25982990e39b1884ed9 Mon Sep 17 00:00:00 2001 From: Nicolas Clerc Date: Tue, 22 Aug 2023 13:21:51 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=F0=9F=9B=82(backend)=20use=20playlist?= =?UTF-8?q?=20token=20in=20apis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/marsha/core/simple_jwt/factories.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/marsha/core/simple_jwt/factories.py b/src/backend/marsha/core/simple_jwt/factories.py index 7eb90857e3..2dea956228 100644 --- a/src/backend/marsha/core/simple_jwt/factories.py +++ b/src/backend/marsha/core/simple_jwt/factories.py @@ -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, @@ -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")