From 2ebbefdec052f5fa88a7a9237da84103fb3be5fa Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 9 Mar 2021 14:27:11 +0100 Subject: [PATCH] reversed condition of raising exception --- .../plugins/publish/collect_matching_asset.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pype/hosts/standalonepublisher/plugins/publish/collect_matching_asset.py b/pype/hosts/standalonepublisher/plugins/publish/collect_matching_asset.py index 48065c4662..089ca32561 100644 --- a/pype/hosts/standalonepublisher/plugins/publish/collect_matching_asset.py +++ b/pype/hosts/standalonepublisher/plugins/publish/collect_matching_asset.py @@ -31,20 +31,20 @@ class CollectMatchingAssetToInstance(pyblish.api.InstancePlugin): matching_asset_doc = asset_doc break - if matching_asset_doc: - instance.data["asset"] = matching_asset_doc["name"] - instance.data["assetEntity"] = matching_asset_doc - self.log.info( - f"Matching asset found: {pformat(matching_asset_doc)}" - ) - - else: + if not matching_asset_doc: # TODO better error message raise AssertionError(( "Filename \"{}\" does not match" " any name of asset documents in database for your selection." ).format(instance.data["source"])) + instance.data["asset"] = matching_asset_doc["name"] + instance.data["assetEntity"] = matching_asset_doc + + self.log.info( + f"Matching asset found: {pformat(matching_asset_doc)}" + ) + def selection_children_by_name(self, instance): storing_key = "childrenDocsForSelection"