Skip to content

Commit

Permalink
Unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jun 20, 2023
1 parent d7992f2 commit a4ace1a
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/design/plone/policy/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from Acquisition import aq_base
from collective.volto.blocksfield.field import BlocksField
from copy import deepcopy
from design.plone.policy.interfaces import IDesignPlonePolicySettings
from design.plone.policy.setuphandlers import disable_searchable_types
from design.plone.policy.setuphandlers import set_default_subsite_colors
from design.plone.policy.utils import create_default_blocks
Expand All @@ -26,7 +25,9 @@


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 @@ -63,7 +64,9 @@ 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 @@ -166,7 +169,9 @@ 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 @@ -227,7 +232,9 @@ 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 @@ -255,7 +262,9 @@ 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 @@ -269,7 +278,9 @@ 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 a4ace1a

Please sign in to comment.