From 76bae583889413183a08245de7a4ba68e20429d3 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 6 May 2020 14:19:28 +0200 Subject: [PATCH] handles are checked for None instead of using `.get(...)` method --- .../global/publish/collect_avalon_entities.py | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/collect_avalon_entities.py b/pype/plugins/global/publish/collect_avalon_entities.py index 53f11aa693..9d16a05a78 100644 --- a/pype/plugins/global/publish/collect_avalon_entities.py +++ b/pype/plugins/global/publish/collect_avalon_entities.py @@ -51,10 +51,26 @@ class CollectAvalonEntities(pyblish.api.ContextPlugin): context.data["frameStart"] = data.get("frameStart") context.data["frameEnd"] = data.get("frameEnd") - handles = int(data.get("handles") or 0) - context.data["handles"] = handles - context.data["handleStart"] = int(data.get("handleStart", handles)) - context.data["handleEnd"] = int(data.get("handleEnd", handles)) + handles = data.get("handles") or 0 + handle_start = data.get("handleStart") + if handle_start is None: + handle_start = handles + self.log.info(( + "Key \"handleStart\" is not set." + " Using value from \"handles\" key {}." + ).format(handle_start)) + + handle_end = data.get("handleEnd") + if handle_end is None: + handle_end = handles + self.log.info(( + "Key \"handleEnd\" is not set." + " Using value from \"handles\" key {}." + ).format(handle_end)) + + context.data["handles"] = int(handles) + context.data["handleStart"] = int(handle_start) + context.data["handleEnd"] = int(handle_end) frame_start_h = data.get("frameStart") - context.data["handleStart"] frame_end_h = data.get("frameEnd") + context.data["handleEnd"]