Skip to content

Commit

Permalink
blacked
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jun 20, 2023
1 parent 6492db5 commit cefd8be
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/design/plone/policy/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@


def update_profile(context, profile, run_dependencies=True):
context.runImportStepFromProfile(
DEFAULT_PROFILE, profile, run_dependencies
)
context.runImportStepFromProfile(DEFAULT_PROFILE, profile, run_dependencies)


def update_types(context):
Expand Down Expand Up @@ -65,9 +63,7 @@ def fix_field_name(blocks):
installOrReinstallProduct(api.portal.get(), "collective.volto.formsupport")
logger.info("Changing form block fields.")
i = 0
brains = api.content.find(
object_provides="plone.restapi.behaviors.IBlocks"
)
brains = api.content.find(object_provides="plone.restapi.behaviors.IBlocks")
tot = len(brains)
fixed_items = []
for brain in brains:
Expand Down Expand Up @@ -170,9 +166,7 @@ def to_1910(context):
else:
new_sizes.append(size)
if "midi 300:65536" not in new_sizes:
new_sizes.insert(
new_sizes.index("mini 200:65536") + 1, "midi 300:65536"
)
new_sizes.insert(new_sizes.index("mini 200:65536") + 1, "midi 300:65536")
api.portal.set_registry_record("plone.allowed_sizes", new_sizes)


Expand Down Expand Up @@ -233,9 +227,7 @@ def fix_block(blocks):
blocks = value.get("blocks", {})
except AttributeError:
logger.warning(
"[RICHTEXT] - {} (not converted)".format(
brain.getURL()
)
"[RICHTEXT] - {} (not converted)".format(brain.getURL())
)
if blocks:
res = fix_block(blocks)
Expand Down Expand Up @@ -263,9 +255,7 @@ def update_folders(context, CHANGES=[], NEW_ITEMS=[]):
portal_name = portal.getId()
for item in CHANGES:
try:
folder = portal.restrictedTraverse(
"{}{}".format(portal_name, item)
)
folder = portal.restrictedTraverse("{}{}".format(portal_name, item))
old_title = folder.title
old_path = "/".join(folder.getPhysicalPath())
api.content.rename(obj=folder, new_id=CHANGES[item][1])
Expand All @@ -279,9 +269,7 @@ def update_folders(context, CHANGES=[], NEW_ITEMS=[]):
)
)
except KeyError:
logger.info(
"{} Impossibile modificare {}{}".format(RED, item, ENDC)
)
logger.info("{} Impossibile modificare {}{}".format(RED, item, ENDC))

for item in NEW_ITEMS:
folder = portal.restrictedTraverse("{}{}".format(portal_name, item[0]))
Expand Down

0 comments on commit cefd8be

Please sign in to comment.