Skip to content

Commit

Permalink
Merge pull request #49 from plone/login_settings_migration
Browse files Browse the repository at this point in the history
Migrate login settings to the configuration registry.
  • Loading branch information
esteele committed Sep 11, 2015
2 parents 04b20c9 + 6dcb359 commit 5fef01c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion plone/app/upgrade/v50/betas.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,27 @@ def to50rc2(context):
# Migrate settings from portal_properties to the configuration registry
pprop = getToolByName(portal, 'portal_properties')
site_properties = pprop['site_properties']
registry = getUtility(IRegistry)

if site_properties.hasProperty('search_results_description_length'):
registry = getUtility(IRegistry)
settings = registry.forInterface(ISearchSchema, prefix='plone')
value = site_properties.getProperty(
'search_results_description_length', 160)
settings.search_results_description_length = value

properties_to_migrate = ['auth_cookie_length',
'verify_login_name',
'external_login_url',
'external_logout_url',
'external_login_iframe']
for p in properties_to_migrate:
if site_properties.hasProperty(p):
value = site_properties.getProperty(p)
registry['plone.%s' % p] = value
site_properties._delProperty(p)

if site_properties.hasProperty('allow_external_login_sites'):
value = site_properties.get('allow_external_login_sites')
if value is not None:
registry['plone.allow_external_login_sites'] = tuple(value)
site_properties._delProperty('allow_external_login_sites')
2 changes: 2 additions & 0 deletions plone/app/upgrade/v50/profiles/to_rc2/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
prefix="plone" />
<records interface="Products.CMFPlone.interfaces.ISearchSchema"
prefix="plone" />
<records interface="Products.CMFPlone.interfaces.ILoginSchema"
prefix="plone" />
</registry>

0 comments on commit 5fef01c

Please sign in to comment.