예제 #1
0
def remove_bootstrap(setup_tool):
    """Remove Bootstrap references on resource registries."""
    css_tool = api.portal.get_tool('portal_css')
    css_tool.unregisterResource(REMOVE_CSS)
    logger.info('Removed Bootstrap CSS references.')

    js_tool = api.portal.get_tool('portal_javascripts')
    js_tool.unregisterResource(REMOVE_JS)
    logger.info('Updated Bootstrap JS references.')
예제 #2
0
def fix_extensions_separator(context):
    """Fix controlpanel valid extensions separator."""
    record = dict(interface=IUploadSettings, name='upload_extensions')
    upload_extensions = api.portal.get_registry_record(**record)
    upload_extensions = upload_extensions.replace(u' ', u'')
    upload_extensions = upload_extensions.replace(u',', u'|')
    record['value'] = upload_extensions
    api.portal.set_registry_record(**record)
    logger.info('Control panel valid extensions separator fixed')
예제 #3
0
def deprecate_resource_registries(setup_tool):
    """Deprecate resource registries."""
    js_tool = api.portal.get_tool('portal_javascripts')
    js_tool.unregisterResource(id=JS)
    assert JS not in js_tool.getResourceIds()  # nosec

    css_tool = api.portal.get_tool('portal_css')
    css_tool.unregisterResource(id=CSS)
    assert CSS not in css_tool.getResourceIds()  # nosec

    logger.info('Static resources were removed from resource registries')
예제 #4
0
def remove_useless_behavior(setup_tool):
    """Remove IMultipleUpload behavior."""
    portal_types = api.portal.get_tool('portal_types')
    msg = 'IMultipleUpload behavior removed from {0} content type'
    for t in portal_types.listContentTypes():
        try:
            behaviors = list(portal_types[t].behaviors)
            if UPLOAD_BEHAVIOR in behaviors:
                behaviors.remove(UPLOAD_BEHAVIOR)
                portal_types[t].behaviors = tuple(behaviors)
                logger.info(msg.format(t))
        except AttributeError:  # not a Dexterity-based content type
            pass
예제 #5
0
def unregister_old_resources(context):
    """Unregister old resources."""
    css_tool = api.portal.get_tool('portal_css')
    resource_list = css_tool.getResourceIds()
    for css in CSS_TO_UNREGISTER:
        if css not in resource_list:
            continue
        css_tool.unregisterResource(css)
    js_tool = api.portal.get_tool('portal_javascripts')
    resource_list = js_tool.getResourceIds()
    for js in JS_TO_UNREGISTER:
        if js not in resource_list:
            continue
        js_tool.unregisterResource(js)
    logger.info('Old resources unregistered')
예제 #6
0
def cook_css_resources(context):  # pragma: no cover
    """Cook CSS resources."""
    css_tool = api.portal.get_tool('portal_css')
    css_tool.cookResources()
    logger.info('CSS resources were cooked')
예제 #7
0
def cook_javascript_resources(context):  # pragma: no cover
    """Cook JavaScript resources."""
    js_tool = api.portal.get_tool('portal_javascripts')
    js_tool.cookResources()
    logger.info('JavaScript resources were cooked')
예제 #8
0
def update_rolemap(setup_tool):
    """Update roles."""
    profile = 'profile-{0}:default'.format(PROJECTNAME)
    setup_tool.runImportStepFromProfile(profile, 'rolemap')
    logger.info('Role map updated.')
예제 #9
0
def update_configlet(setup_tool):
    """Update control panel configlet."""
    profile = 'profile-{0}:default'.format(PROJECTNAME)
    setup_tool.runImportStepFromProfile(profile, 'controlpanel')
    logger.info('Control panel configlet updated.')
예제 #10
0
def update_jsregistry(setup_tool):
    """Update jsregistry"""
    profile = 'profile-{0}:default'.format(PROJECTNAME)
    setup_tool.runImportStepFromProfile(profile, 'jsregistry')
    logger.info('JS registry updated.')