[CMF-checkins] CVS: CMF/CMFSetup - PROFILES.txt:1.1.2.1 actions.py:1.13.2.4 skins.py:1.8.2.5 tool.py:1.18.2.5 utils.py:1.13.2.5

Yvo Schubbe y.2005- at wcm-solutions.de
Mon Apr 11 07:33:02 EDT 2005


Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv2326/CMFSetup

Modified Files:
      Tag: CMF-1_5-branch
	actions.py skins.py tool.py utils.py 
Added Files:
      Tag: CMF-1_5-branch
	PROFILES.txt 
Log Message:
improved update behavior of extension profiles (see PROFILES.txt for details)


=== Added File CMF/CMFSetup/PROFILES.txt ===
Profiles

  Overview

    There are two different kinds of profiles: Base profiles and extension
    profiles. Base profiles have no dependencies. Extension profiles are
    profile fragments used to modify base profiles. They can be shipped with
    add-on products or used for customization steps. Importing an extension
    profile adds or overwrites existing settings in a fine-grained way. You
    can't export extension profiles. Snapshots and exports always represent
    the merged settings.

  Update Directives

    For some XML elements there are additional attributes and values to
    specify update directives. They are only useful for extension profiles and
    you will never see them in snapshots and exports.

    'insert-before' and 'insert-after'

      applies to: object (generic); layer (skins.xml)

      'insert-before' and 'insert-after' specify the position of a new item
      relative to an existing item. If they are omitted or not valid, items
      are appended. You can also use '*' as wildcard. This will insert the new
      item at the top (before all existing items) or the bottom (after all
      existing items). If an item with the given ID exists already, it is
      moved to the specified position.

    'id="*"' wildcard

      applies to: skin-path (skins.xml)

      Updates all existing items in the container with the same settings.


=== CMF/CMFSetup/actions.py 1.13.2.3 => 1.13.2.4 ===
--- CMF/CMFSetup/actions.py:1.13.2.3	Sun Mar 13 11:22:55 2005
+++ CMF/CMFSetup/actions.py	Mon Apr 11 07:32:31 2005
@@ -166,7 +166,7 @@
 
         return {
           'actions-tool':
-             { 'action-provider': {KEY: 'providers'} },
+             { 'action-provider': {KEY: 'providers', DEFAULT: ()} },
           'action-provider':
              { 'id':              {},
                'action':          {KEY: 'actions', DEFAULT: ()} },


=== CMF/CMFSetup/skins.py 1.8.2.4 => 1.8.2.5 ===
--- CMF/CMFSetup/skins.py:1.8.2.4	Sun Mar 27 13:01:35 2005
+++ CMF/CMFSetup/skins.py	Mon Apr 11 07:32:31 2005
@@ -135,20 +135,29 @@
     for layer in layer_infos:
         if layer['name'] in path:
             path.remove(layer['name'])
+
         if 'insert-before' in layer:
-            try:
-                index = path.index(layer['insert-before'])
-                path.insert(index, layer['name'])
+            if layer['insert-before'] == '*':
+                path.insert(0, layer['name'])
                 continue
-            except ValueError:
-                pass
-        if 'insert-after' in layer:
-            try:
-                index = path.index(layer['insert-after'])
-                path.insert(index+1, layer['name'])
-                continue
-            except ValueError:
+            else:
+                try:
+                    index = path.index(layer['insert-before'])
+                    path.insert(index, layer['name'])
+                    continue
+                except ValueError:
+                    pass
+        elif 'insert-after' in layer:
+            if layer['insert-after'] == '*':
                 pass
+            else:
+                try:
+                    index = path.index(layer['insert-after'])
+                    path.insert(index+1, layer['name'])
+                    continue
+                except ValueError:
+                    pass
+
         path.append(layer['name'])
 
     return str( ','.join(path) )


=== CMF/CMFSetup/tool.py 1.18.2.4 => 1.18.2.5 ===
--- CMF/CMFSetup/tool.py:1.18.2.4	Tue Apr  5 11:17:16 2005
+++ CMF/CMFSetup/tool.py	Mon Apr 11 07:32:31 2005
@@ -69,12 +69,15 @@
     """
     site = context.getSite()
     encoding = context.getEncoding()
-    text = context.readDataFile( TOOLSET_XML )
+
+    xml = context.readDataFile(TOOLSET_XML)
+    if xml is None:
+        return 'Toolset: Nothing to import.'
 
     setup_tool = getToolByName( site, 'portal_setup' )
     toolset = setup_tool.getToolsetRegistry()
 
-    toolset.parseXML(text, encoding)
+    toolset.parseXML(xml, encoding)
 
     existing_ids = site.objectIds()
     existing_values = site.objectValues()
@@ -100,7 +103,7 @@
                 site._delObject( tool_id )
                 site._setObject( tool_id, tool_class() )
 
-    return 'Toolset imported'
+    return 'Toolset imported.'
 
 def exportToolset( context ):
 
@@ -113,7 +116,7 @@
     xml = toolset.generateXML()
     context.writeDataFile( TOOLSET_XML, xml, 'text/xml' )
 
-    return 'Toolset exported'
+    return 'Toolset exported.'
 
 
 class SetupTool( UniqueObject, Folder ):


=== CMF/CMFSetup/utils.py 1.13.2.4 => 1.13.2.5 ===
--- CMF/CMFSetup/utils.py:1.13.2.4	Tue Apr  5 13:19:34 2005
+++ CMF/CMFSetup/utils.py	Mon Apr 11 07:32:31 2005
@@ -218,6 +218,8 @@
           'object':
             { 'name':            {KEY: 'id'},
               'meta_type':       {},
+              'insert-before':   {},
+              'insert-after' :   {},
               'property':        {KEY: 'properties', DEFAULT: ()},
               'object':          {KEY: 'objects', DEFAULT: ()} },
           'property':
@@ -263,7 +265,7 @@
     security.declareProtected(ManagePortal, 'initObject')
     def initObject(self, parent, o_info):
 
-        obj_id = o_info['id']
+        obj_id = str(o_info['id'])
         if obj_id not in parent.objectIds():
             meta_type = o_info['meta_type']
             for mt_info in Products.meta_types:
@@ -273,6 +275,25 @@
             else:
                 raise ValueError('unknown meta_type \'%s\'' % obj_id)
         obj = parent._getOb(obj_id)
+
+        if 'insert-before' in o_info:
+            if o_info['insert-before'] == '*':
+                parent.moveObjectsToTop(obj_id)
+            else:
+                try:
+                    position = parent.getObjectPosition(o_info['insert-before'])
+                    parent.moveObjectToPosition(obj_id, position)
+                except ValueError:
+                    pass
+        elif 'insert-after' in o_info:
+            if o_info['insert-after'] == '*':
+                parent.moveObjectsToBottom(obj_id)
+            else:
+                try:
+                    position = parent.getObjectPosition(o_info['insert-after'])
+                    parent.moveObjectToPosition(obj_id, position+1)
+                except ValueError:
+                    pass
 
         [ self.initObject(obj, info) for info in o_info['objects'] ]
 



More information about the CMF-checkins mailing list