Exemple #1
0
def installPloneAppDiscussion(portal):
    # Make sure plone.app.discussion is properly installed.
    installOrReinstallProduct(
        portal,
        'plone.app.discussion',
        out=None,
        hidden=True)
Exemple #2
0
def installPloneAppDiscussion(portal):
    # Make sure plone.app.discussion is properly installed.
    installOrReinstallProduct(
        portal,
        "plone.app.discussion",
        out=None,
        hidden=True)
def to_1600(context):
    installOrReinstallProduct(api.portal.get(), "collective.volto.subsites")
    set_default_subsite_colors()
    logger.info("### CHANGE SUBSITE COLOR light-blue => teal")
    subsites = api.content.find(portal_type="Subsite")
    for brain in subsites:
        subsite = brain.getObject()
        if getattr(subsite, "subsite_css_class", "") == "light-blue":
            subsite.subsite_css_class = "teal"
            logger.info("- {}".format(brain.getURL()))
Exemple #4
0
def to_2000(context):
    portal_types = api.portal.get_tool(name="portal_types")
    document_behaviors = list(
        portal_types["Document"].behaviors) + ["volto.preview_image"]

    old_images = api.portal.get_registry_record(name="plone.allowed_sizes")
    installOrReinstallProduct(api.portal.get(), "plone.volto")

    # adjust behaviors
    portal_types["Document"].behaviors = tuple(document_behaviors)

    # adjust image scales
    new_images = api.portal.get_registry_record(name="plone.allowed_sizes")
    new_keys = [x.split(" ")[0] for x in new_images]
    for old_value in old_images:
        miniature = old_value.split(" ")[0]
        if miniature not in new_keys:
            new_images.append(old_value)

    api.portal.set_registry_record("plone.allowed_sizes", new_images)
def to_1200(context):
    def fix_field_name(blocks):
        """
        """
        found = False
        for block in blocks.values():
            if block.get("@type", "") == "form" and block.get("to", ""):
                block["default_to"] = block.get("to", "")
                del block["to"]
                found = True
        return found

    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")
    tot = len(brains)
    fixed_items = []
    for brain in brains:
        i += 1
        if i % 1000 == 0:
            logger.info("Progress: {}/{}".format(i, tot))
        item = brain.getObject()
        blocks = deepcopy(getattr(item, "blocks", {}))
        if blocks:
            to_update = fix_field_name(blocks)
            if to_update:
                item.blocks = blocks
                fixed_items.append(brain.getPath())

    logger.info("Finish")
    if fixed_items:
        logger.info("Updated items:")
        for fixed in fixed_items:
            logger.info("- {}".format(fixed))
    else:
        logger.info("No items affected.")
def to_1005(context):
    'Install collective.slick'
    installOrReinstallProduct(
        api.portal.get(),
        'collective.slick',
    )
Exemple #7
0
def installProduct(product, portal, out=None, hidden=False):
    """Quickinstalls a product if it is not installed yet."""
    if out is None:
        out = []
    installOrReinstallProduct(portal, product, out, hidden=hidden)
Exemple #8
0
def upgrade_1001_1002(context):
    '''Installs vnccollab.common.'''
    portal = api.portal.get()
    installOrReinstallProduct(portal, 'vnccollab.common')
Exemple #9
0
def to_1400(context):
    installOrReinstallProduct(api.portal.get(),
                              "collective.z3cform.jsonwidget")
    update_registry(context)
    update_controlpanel(context)
Exemple #10
0
def upgrade_1000_1001(context):
    '''Installs vnccollab.common.'''
    portal = api.portal.get()
    installOrReinstallProduct(portal, 'vnccollab.common')
Exemple #11
0
def installProduct(product, portal, out=None, hidden=False):
    """Quickinstalls a product if it is not installed yet."""
    if out is None:
        out = []
    installOrReinstallProduct(portal, product, out, hidden=hidden)
def to_1008(context):
    installOrReinstallProduct(api.portal.get(), "redturtle.bandi")