From 5ffbf4b411a9b41c2abb1b1838af9fc0c5e455bb Mon Sep 17 00:00:00 2001 From: Nikolay Zhuravlev Date: Tue, 30 Aug 2022 11:10:10 +0300 Subject: [PATCH] Debug is_s3_stored --- anytask/issues/tests.py | 1 + anytask/storage.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/anytask/issues/tests.py b/anytask/issues/tests.py index 65ad2ec1..b5fc5686 100644 --- a/anytask/issues/tests.py +++ b/anytask/issues/tests.py @@ -1136,6 +1136,7 @@ def test_rewrite_url_only_existing(self): '''Note: updated model: {}, {}''').format( expected_s3_path, file, expected_s3_path, file, expected_s3_path) file = File.objects.get(pk=file.pk) + print(f">>>>>>>>>>>>>>>>>>>filename:{file.file.name} {S3OverlayStorage.is_s3_stored(file.file.name)}") self.assertTrue(S3OverlayStorage.is_s3_stored(file.file.name)) self.assertTrue(self.s3_storage.exists(file.file.name)) self.assertEqual(expected_stdout, out.getvalue().strip()) diff --git a/anytask/storage.py b/anytask/storage.py index 2e8efaf5..08f3e2f7 100644 --- a/anytask/storage.py +++ b/anytask/storage.py @@ -58,6 +58,9 @@ def _dispatch(self, name, method_name, *args, **kwargs): @classmethod def is_s3_stored(cls, name): + ret = name.lstrip('/').startswith(cls.S3_STORED_MAGIC + '/') + name_stripped = name.lstrip('/') + print(f"!!!!!!!!!! NAMAE:{name} {name_stripped} {ret}") return name.lstrip('/').startswith(cls.S3_STORED_MAGIC + '/') @classmethod