From d9af179f8fda9182441e3a685fd2cea975ca17a0 Mon Sep 17 00:00:00 2001 From: RedTurtle Date: Mon, 9 Dec 2024 17:00:06 +0100 Subject: [PATCH] fixed check --- src/design/plone/contenttypes/upgrades/to_7001.py | 2 +- src/design/plone/contenttypes/upgrades/upgrades.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/design/plone/contenttypes/upgrades/to_7001.py b/src/design/plone/contenttypes/upgrades/to_7001.py index 9d56428c..13a10b39 100644 --- a/src/design/plone/contenttypes/upgrades/to_7001.py +++ b/src/design/plone/contenttypes/upgrades/to_7001.py @@ -300,7 +300,7 @@ def migrated_contact_info(source): continue if not migrated_contact_info(obj): - if hasattr(aq_base(obj), "contact_info"): + if getattr(aq_base(obj), "contact_info"): obj.old_contact_info = obj.contact_info if obj.portal_type == "UnitaOrganizzativa": del obj.contact_info diff --git a/src/design/plone/contenttypes/upgrades/upgrades.py b/src/design/plone/contenttypes/upgrades/upgrades.py index f7bf4949..8bfabb2e 100644 --- a/src/design/plone/contenttypes/upgrades/upgrades.py +++ b/src/design/plone/contenttypes/upgrades/upgrades.py @@ -1415,12 +1415,15 @@ def update_folder_for_gallery(self): pc = api.portal.get_tool(name="portal_catalog") for brain in pc(portal_type="Event"): evento = brain.getObject() - logger.info(f"{colors.DARKCYAN} Event: {evento.absolute_url()} {colors.ENDC}") if "multimedia" in evento.keys(): - renamed_event = api.content.rename(evento["multimedia"], new_id="immagini") - renamed_event.title = "Immagini" - renamed_event.reindexObject(idxs=["id", "title"]) + try: + renamed_event = api.content.rename(evento["multimedia"], new_id="immagini") + renamed_event.title = "Immagini" + renamed_event.reindexObject(idxs=["id", "title"]) + except: + import pdb;pdb.set_trace() + logger.info(f"{colors.GREEN} Rename multimedia {colors.ENDC}") if "video" not in evento.keys():