From 05a3b9c95db4b3f19d8723b2c56dcb57abc49941 Mon Sep 17 00:00:00 2001 From: bkfox Date: Mon, 10 Oct 2022 18:23:19 +0200 Subject: [PATCH] path bug --- aircox/models/program.py | 7 ++----- aircox/settings.py | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/aircox/models/program.py b/aircox/models/program.py index 90845f0..e55967d 100644 --- a/aircox/models/program.py +++ b/aircox/models/program.py @@ -98,13 +98,10 @@ class Program(Page): Return a Program from the given path. We assume the path has been given in a previous time by this model (Program.path getter). """ - if path.startswith(conf.MEDIA_ROOT): - path = path.replace(conf.MEDIA_ROOT + '/', '') - path = path.replace(settings.AIRCOX_PROGRAMS_DIR, '') - + if path.startswith(settings.AIRCOX_PROGRAMS_DIR): + path = path.replace(settings.AIRCOX_PROGRAMS_DIR + '/', '') while path[0] == '/': path = path[1:] - path = path[:path.index('/')] return cl.objects.filter(slug=path.replace('_','-')).first() diff --git a/aircox/settings.py b/aircox/settings.py index fb54742..6d8d504 100755 --- a/aircox/settings.py +++ b/aircox/settings.py @@ -86,8 +86,7 @@ ensure('AIRCOX_DEFAULT_USER_GROUPS', { }) # Directory for the programs data -# TODO: rename to PROGRAMS_ROOT -ensure('AIRCOX_PROGRAMS_DIR', 'programs') +ensure('AIRCOX_PROGRAMS_DIR', os.path.join(settings.MEDIA_ROOT, 'programs')) ########################################################################