[CMF-checkins] CVS: CMF/CMFSetup - PROFILES.txt:1.3 actions.py:1.21 typeinfo.py:1.23

Yvo Schubbe y.2005- at wcm-solutions.de
Wed Apr 13 09:06:28 EDT 2005


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

Modified Files:
	PROFILES.txt actions.py typeinfo.py 
Log Message:
more improvements for extension profiles:
- implemented 'remove' for action providers
- refactored typeinfo imports to allow modifying existing typeinfos (doesn't work for single type actions)


=== CMF/CMFSetup/PROFILES.txt 1.2 => 1.3 ===
--- CMF/CMFSetup/PROFILES.txt:1.2	Mon Apr 11 07:33:17 2005
+++ CMF/CMFSetup/PROFILES.txt	Wed Apr 13 09:05:58 2005
@@ -32,3 +32,9 @@
       applies to: skin-path (skins.xml)
 
       Updates all existing items in the container with the same settings.
+
+    'remove'
+
+      applies to: action-provider (actions.xml)
+
+      Removes the specified item if it exists.


=== CMF/CMFSetup/actions.py 1.20 => 1.21 ===
--- CMF/CMFSetup/actions.py:1.20	Mon Apr 11 07:33:17 2005
+++ CMF/CMFSetup/actions.py	Wed Apr 13 09:05:58 2005
@@ -84,6 +84,11 @@
 
     for p_info in tool_info['providers']:
 
+        if 'remove' in p_info:
+            if p_info['id'] in actions_tool.listActionProviders():
+                actions_tool.deleteActionProvider(p_info['id'])
+            continue
+
         if p_info['id'] in _SPECIAL_PROVIDERS and \
                 p_info['id'] not in actions_tool.listActionProviders():
             actions_tool.addActionProvider(p_info['id'])
@@ -221,6 +226,7 @@
                'object':          {KEY: 'objects', DEFAULT: ()} },
           'action-provider':
              { 'id':              {},
+               'remove':          {},
                'action':          {KEY: 'actions', DEFAULT: ()} },
           'action':
              { 'action_id':       {KEY: 'id'},


=== CMF/CMFSetup/typeinfo.py 1.22 => 1.23 ===
--- CMF/CMFSetup/typeinfo.py:1.22	Sun Apr  3 16:20:41 2005
+++ CMF/CMFSetup/typeinfo.py	Wed Apr 13 09:05:58 2005
@@ -67,18 +67,40 @@
             text = context.readDataFile( filename[sep+1:], filename[:sep] )
         info = tic.parseXML( text )
 
-        for mt_info in Products.meta_types:
-            if mt_info['name'] == info['kind']:
-                type_info = mt_info['instance'](**info)
-                break
+        type_id = str(info['id'])
+        if 'kind' in info:
+            for mt_info in Products.meta_types:
+                if mt_info['name'] == info['kind']:
+                    type_info = mt_info['instance'](type_id)
+                    break
+            else:
+                raise ValueError('unknown kind \'%s\'' % info['kind'])
+
+            if type_id in types_tool.objectIds():
+                types_tool._delObject(type_id)
+
+            types_tool._setObject(type_id, type_info)
+            type_info = types_tool._getOb(type_id)
+            type_info._updateProperty('title', info['id'])
+            type_info._updateProperty('content_meta_type', info['id'])
+            type_info._updateProperty('content_icon', '%s.png' % info['id'])
+            type_info._updateProperty('immediate_view',
+                                      '%s_edit' % info['id'])
         else:
-            raise ValueError('unknown kind \'%s\'' % info['kind'])
+            type_info = types_tool._getOb(type_id)
 
-        if info['id'] in types_tool.objectIds():
-            types_tool._delObject(info['id'])
+        type_info.manage_changeProperties(**info)
 
-        types_tool._setObject( str( info[ 'id' ] ), type_info )
+        if 'actions' in info:
+            type_info._actions = info['actions']
 
+        if 'aliases' in info:
+            if not getattr(type_info, '_aliases', False):
+                aliases = info['aliases']
+            else:
+                aliases = type_info.getMethodAliases()
+                aliases.update(info['aliases'])
+            type_info.setMethodAliases(aliases)
 
     # XXX: YAGNI?
     # importScriptsToContainer(types_tool, ('typestool_scripts',),
@@ -238,18 +260,15 @@
           'type-info':
             { 'id':                   {},
               'kind':                 {},
-              'title':                {DEFAULT: '%(id)s'},
+              'title':                {},
               'description':          {CONVERTER: self._convertToUnique},
-              'meta_type':            {DEFAULT: '%(id)s'},
-              'icon':                 {DEFAULT: '%(id)s.png'},
-              'immediate_view':       {DEFAULT: '%(id)s_edit'},
-              'global_allow':         {DEFAULT: True,
-                                       CONVERTER: self._convertToBoolean},
-              'filter_content_types': {DEFAULT: False,
-                                       CONVERTER: self._convertToBoolean},
+              'meta_type':            {KEY: 'content_meta_type'},
+              'icon':                 {KEY: 'content_icon'},
+              'immediate_view':       {},
+              'global_allow':         {CONVERTER: self._convertToBoolean},
+              'filter_content_types': {CONVERTER: self._convertToBoolean},
               'allowed_content_type': {KEY: 'allowed_content_types'},
-              'allow_discussion':     {DEFAULT: False,
-                                       CONVERTER: self._convertToBoolean},
+              'allow_discussion':     {CONVERTER: self._convertToBoolean},
               'aliases':              {CONVERTER: self._convertAliases},
               'action':               {KEY: 'actions'},
               'product':              {},



More information about the CMF-checkins mailing list