Update repo.py

Check if slug exists in data.
Without this check, import fail when SLUGS are not none in .env
This commit is contained in:
BorisBachere 2023-10-02 15:31:00 +02:00 committed by GitHub
parent 226210ad55
commit 0dbd34956d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,10 @@ class DTLRepo:
# Save file location to resolve any relative paths for images
data['src'] = file
if slugs and True not in [True if s.casefold() in data['slug'].casefold() else False for s in slugs]:
match_any_given_slug_wildcard = any(
[s.lower() in data["slug"].lower() for s in slugs if "slug" in data]
)
if not match_any_given_slug_wildcard:
self.handle.verbose_log(f"Skipping {data['model']}")
continue