Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add upgrade step for imaging control panel #31

Merged
merged 2 commits into from
May 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions plone/app/upgrade/v50/betas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from zope.component import getUtility
from zope.component.hooks import getSite
from Products.CMFCore.interfaces import ISiteRoot
from Products.CMFPlone.interfaces.controlpanel import IImagingSchema


def to50beta1(context):
Expand Down Expand Up @@ -46,7 +47,7 @@ def upgrade_portal_language(context):
portal_languages = getSite().portal_languages
lang_settings.available_languages = portal_languages.supported_langs

lang_settings.use_combined_language_codes = portal_languages.use_combined_language_codes
lang_settings.use_combined_language_codes = portal_languages.use_combined_language_codes # noqa
lang_settings.display_flags = portal_languages.display_flags

lang_settings.use_path_negotiation = portal_languages.use_path_negotiation
Expand All @@ -57,7 +58,7 @@ def upgrade_portal_language(context):
lang_settings.authenticated_users_only = portal_languages.authenticated_users_only
lang_settings.use_request_negotiation = portal_languages.use_request_negotiation
lang_settings.use_cctld_negotiation = portal_languages.use_cctld_negotiation
lang_settings.use_subdomain_negotiation = portal_languages.use_subdomain_negotiation
lang_settings.use_subdomain_negotiation = portal_languages.use_subdomain_negotiation # noqa
if hasattr(portal_languages, 'always_show_selector'):
lang_settings.always_show_selector = portal_languages.always_show_selector

Expand All @@ -69,7 +70,6 @@ def upgrade_portal_language(context):
# directory="Products.PloneLanguageTool:skins/LanguageTool"/>



def upgrade_mail_controlpanel_settings(context):
registry = getUtility(IRegistry)
# XXX: Somehow this code is executed for old migration steps as well
Expand Down Expand Up @@ -187,3 +187,21 @@ def _get_enable_self_reg():
'use_email_as_login', False)
settings.use_uuid_as_userid = site_properties.getProperty(
'use_uuid_as_userid', False)


def to50beta2(context):
"""5.0alpha3 -> 5.0beta1"""
loadMigrationProfile(context, 'profile-plone.app.upgrade.v50:to50beta2')
portal = getSite()

registry = getUtility(IRegistry)
settings = registry.forInterface(IImagingSchema, prefix="plone")

try:
iprops = portal.portal_properties.imaging_properties

settings.allowed_sizes = [s.decode('utf8') for s in iprops.getProperty('allowed_sizes')] # noqa
settings.quality = iprops.getProperty('quality')
except AttributeError:
# will only be there if from older plone instance
pass
12 changes: 12 additions & 0 deletions plone/app/upgrade/v50/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,17 @@
/>

</gs:upgradeSteps>
<gs:upgradeSteps
source="5004"
destination="5005"
profile="Products.CMFPlone:plone">

<gs:upgradeStep
title="Run to50beta1 upgrade profile"
description=""
handler=".betas.to50beta2"
/>

</gs:upgradeSteps>

</configure>
8 changes: 8 additions & 0 deletions plone/app/upgrade/v50/profiles.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:registerProfile
name="to50beta2"
title="Upgrade profile for Plone 5004 to Plone 5.0beta1"
description=""
directory="profiles/to_beta2"
for="Products.CMFPlone.interfaces.IMigratingPloneSiteRoot"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
</configure>
7 changes: 7 additions & 0 deletions plone/app/upgrade/v50/profiles/to_beta2/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<registry>
<records interface="Products.CMFPlone.interfaces.ITinyMCESchema"
prefix="plone" />
<records interface="Products.CMFPlone.interfaces.IImagingSchema"
prefix="plone" />
</registry>