From 4e07b756af65cdb08c58271976bf95b7216ad306 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Mon, 3 Jun 2024 12:06:29 +0200 Subject: [PATCH] AY-5539 - fix wrong logic --- client/ayon_core/tools/publisher/control.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/tools/publisher/control.py b/client/ayon_core/tools/publisher/control.py index c9680b1d9e..72a89d2a3a 100644 --- a/client/ayon_core/tools/publisher/control.py +++ b/client/ayon_core/tools/publisher/control.py @@ -1841,7 +1841,7 @@ class PublisherController(BasePublisherController): allowed_creator_labels = self._get_allowed_creator_labels() for identifier, creator in self._create_context.creators.items(): try: - if (not self._label_matches_allowed( + if (not self._is_label_allowed( creator.label, allowed_creator_labels)): self.log.debug(f"{creator.label} not allowed for context") continue @@ -1888,13 +1888,12 @@ class PublisherController(BasePublisherController): self.log.debug(f"Only allowed `{allowed_creator_labels}` creators") return allowed_creator_labels - def _label_matches_allowed(self, label, allowed_labels): + def _is_label_allowed(self, label, allowed_labels): """Implement regex support for allowed labels.""" - if allowed_labels: - allowed_patterns = re.compile("|".join(allowed_labels)) - if allowed_patterns.match(label): - return True - return False + if not allowed_labels: + return True + allowed_patterns = re.compile("|".join(allowed_labels)) + return bool(allowed_patterns.match(label)) def _reset_instances(self): """Reset create instances."""