From 745cd9343332335fb23294cb3d8551305cdf7f10 Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Tue, 14 Jun 2022 13:41:31 +0000 Subject: [PATCH] fix slash --- fet2020/gallery/utils.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fet2020/gallery/utils.py b/fet2020/gallery/utils.py index 83efdaae..32ee213b 100644 --- a/fet2020/gallery/utils.py +++ b/fet2020/gallery/utils.py @@ -13,7 +13,7 @@ valid_images = [".jpg", ".png"] def get_image_list(folder_name): - file_path = os.path.join(settings.MEDIA_ROOT + "/" + gallery_path, folder_name) + file_path = os.path.join(settings.MEDIA_ROOT + gallery_path, folder_name) img_list = [] if os.path.exists(file_path): @@ -23,7 +23,7 @@ def get_image_list(folder_name): continue thumb_path = os.path.join( - settings.MEDIA_ROOT + "/" + gallery_thumb_path, folder_name + settings.MEDIA_ROOT + gallery_thumb_path, folder_name ) thumb_file_path = os.path.join(thumb_path, f"thumb_{img}") if os.path.exists(thumb_file_path): @@ -48,17 +48,15 @@ def get_image_list(folder_name): def get_folder_list(): - if os.path.exists(settings.MEDIA_ROOT + "/" + gallery_path): - return next(os.walk(settings.MEDIA_ROOT + "/" + gallery_path))[1] + if os.path.exists(settings.MEDIA_ROOT + gallery_path): + return next(os.walk(settings.MEDIA_ROOT + gallery_path))[1] return None def create_thumbs(folder_path): - file_path = os.path.join(settings.MEDIA_ROOT + "/" + gallery_path, folder_path) - thumb_path = os.path.join( - settings.MEDIA_ROOT + "/" + gallery_thumb_path, folder_path - ) + file_path = os.path.join(settings.MEDIA_ROOT + gallery_path, folder_path) + thumb_path = os.path.join(settings.MEDIA_ROOT + gallery_thumb_path, folder_path) if os.path.exists(file_path): os.makedirs(thumb_path, exist_ok=True)