Skip to content

Commit

Permalink
services Fix bug that was overriding label with step name and fix s…
Browse files Browse the repository at this point in the history
…ome typos on logging
  • Loading branch information
farrizabalaga authored and Minkiu committed Jan 25, 2024
1 parent 611a0a7 commit b160a33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions services/shotgrid_common/ayon_shotgrid_hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def project_name(self, project_name):
try:
self._ay_project = EntityHub(project_name)
self._ay_project.project_entity
logging.info(f"Project {project_name} <{self._ay_project.project_entity.id}> already exist in AYON.")
logging.info(f"Project {project_name} <{self._ay_project.project_entity.id}> already exists in AYON.")
except Exception as err:
logging.warning(f"Project {project_name} does not exist in AYON.")
log_traceback(err)
Expand All @@ -186,7 +186,7 @@ def project_name(self, project_name):
CUST_FIELD_CODE_AUTO_SYNC
]
)
logging.info(f"Project {project_name} ({self._sg_project[self.sg_project_code_field]}) <{self._sg_project['id']}> already exist in Shotgrid.")
logging.info(f"Project {project_name} ({self._sg_project[self.sg_project_code_field]}) <{self._sg_project['id']}> already exists in Shotgrid.")
except Exception as e:
logging.warning(f"Project {project_name} does not exist in Shotgrid. ")
log_traceback(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ def update_ayon_entity_from_sg_event(sg_event, sg_session, ayon_entity_hub, proj
)

if not ay_entity:
logging.error("Unable to update an non existant entity.")
raise ValueError("Unable to update an non existant entity.")
logging.error("Unable to update a non existing entity.")
raise ValueError("Unable to update a non existing entity.")

if int(ay_entity.attribs.get_attribute(SHOTGRID_ID_ATTRIB).value) != int(sg_entity_dict.get(SHOTGRID_ID_ATTRIB)):
logging.error("Missmatching Shotgrid IDs, aborting...")
raise ValueError("Missmatching Shotgrid IDs, aborting...")
logging.error("Mismatching Shotgrid IDs, aborting...")
raise ValueError("Mismatching Shotgrid IDs, aborting...")

if sg_event["attribute_name"] in ["code", "name"]:
if ay_entity.name != sg_entity_dict["name"]:
Expand Down Expand Up @@ -273,12 +273,12 @@ def remove_ayon_entity_from_sg_event(sg_event, sg_session, ayon_entity_hub, proj
)

if not ay_entity:
logging.error("Unable to update an non existant entity.")
raise ValueError("Unable to update an non existant entity.")
logging.error("Unable to update a non existing entity.")
raise ValueError("Unable to update a non existing entity.")

if sg_entity_dict.get(CUST_FIELD_CODE_ID) != ay_entity.id:
logging.error("Missmatching Shotgrid IDs, aborting...")
raise ValueError("Missmatching Shotgrid IDs, aborting...")
logging.error("Mismatching Shotgrid IDs, aborting...")
raise ValueError("Mismatching Shotgrid IDs, aborting...")

if not ay_entity.immutable_for_hierarchy:
logging.info(f"Deleting AYON entity: {ay_entity}")
Expand Down
2 changes: 0 additions & 2 deletions services/shotgrid_common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def _sg_to_ay_dict(sg_entity: dict, project_code_field=None) -> dict:

if not label and not task_type:
raise ValueError(f"Unable to parse Task {sg_entity}")
else:
label = sg_entity["step"]["name"]

name = slugify_string(label)

Expand Down

0 comments on commit b160a33

Please sign in to comment.