[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/Extensions/migrateToCMF21.py - replaced by GenericSetup upgrade steps in CMFDefault

Jens Vagelpohl jens at dataflake.org
Thu Dec 10 03:54:20 EST 2009


Log message for revision 106366:
  - replaced by GenericSetup upgrade steps in CMFDefault
  

Changed:
  D   Products.CMFCore/trunk/Products/CMFCore/Extensions/migrateToCMF21.py

-=-
Deleted: Products.CMFCore/trunk/Products/CMFCore/Extensions/migrateToCMF21.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/Extensions/migrateToCMF21.py	2009-12-10 08:52:12 UTC (rev 106365)
+++ Products.CMFCore/trunk/Products/CMFCore/Extensions/migrateToCMF21.py	2009-12-10 08:54:20 UTC (rev 106366)
@@ -1,86 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" migrateToCMF21.py: Migrate older instances to CMF 2.1
-
-This script must be executed using "zopectl run".
-
-$Id$
-"""
-
-from logging import getLogger
-import sys
-import transaction
-
-logger = getLogger('event.migrateToCMF21')
-
-# The following extensions have a componentregistry.xml import step, and
-# the existence of the ID they're mapped to in the portal means the import
-# step must be run
-AFFECTED_EXTENSIONS = { 
-      'Products.CMFCalendar:default' : 'portal_calendar'
-    , 'Products.CMFUid:default' : 'portal_uidhandler'
-    , 'Products.CMFActionIcons:actionicons' : 'portal_actionicons'
-    }
-
-def _log(msg):
-    logger.info(msg)
-    print msg
-
-
-def migrate_site(site):
-    """ Migrate a single site
-    """
-
-    site_path = '/'.join(site.getPhysicalPath())
-    _log(' - converting site at %s' % site_path)
-    ps = site.portal_setup
-
-    # Check if we have new-style action providers, if not we need to
-    # run the action provider step from CMFDefault:default as well
-    if not site.portal_actions.objectIds(['CMF Action Category']):
-        steps = ('actions',) # Runs componentregistry as dependency
-    else:
-        steps = ('componentregistry',)
-
-    for step in steps:
-        ps.runImportStepFromProfile('profile-Products.CMFDefault:default',
-                step, run_dependencies=True)
-
-    # Now we go through the extensions that may need to be run
-    for extension_id, object_id in AFFECTED_EXTENSIONS.items():
-        if object_id in site.objectIds():
-            ps.runImportStepFromProfile('profile-' + extension_id,
-                    'componentregistry', run_dependencies=True)
-
-    _log(' - finished converting site at %s' % site_path)
-
-
-if __name__ == '__main__':
-
-    _log('Starting CMF migration.')
-    
-    # First step: Find all instances of CMFSite
-    sites = app.ZopeFind(app, obj_metatypes=['CMF Site'], search_sub=1)
-
-    if len(sites) == 0:
-        _log('No CMF Site objects found - aborting.')
-        sys.exit(1)
-
-    # For every site, grab the portal_setup tool and run the required steps
-    for site_id, site in sites:
-        migrate_site(site)
-        transaction.get().note('Migrated CMF site "%s"' % site_id)
-        transaction.commit()
-
-    _log('CMF migration finished.')
-



More information about the checkins mailing list