[CMF-checkins] SVN: CMF/branches/1.6/C Fixed import of action icons
in extension profiles.
Florent Guillaume
fg at nuxeo.com
Wed Feb 1 11:46:02 EST 2006
Log message for revision 41534:
Fixed import of action icons in extension profiles.
Changed:
U CMF/branches/1.6/CHANGES.txt
U CMF/branches/1.6/CMFActionIcons/exportimport.py
U CMF/branches/1.6/CMFActionIcons/tests/test_exportimport.py
-=-
Modified: CMF/branches/1.6/CHANGES.txt
===================================================================
--- CMF/branches/1.6/CHANGES.txt 2006-02-01 15:10:13 UTC (rev 41533)
+++ CMF/branches/1.6/CHANGES.txt 2006-02-01 16:46:01 UTC (rev 41534)
@@ -8,8 +8,9 @@
- Removed BBBTransaction class from CMFCore.utils
- - Fixed import of actions from extension profiles, now they don't
- overwrite all previous actions in the action provider.
+ - Extension profiles: Fixed import of actions, now they don't
+ overwrite all previous actions in the action provider. Fixed
+ import of action icons.
Features
Modified: CMF/branches/1.6/CMFActionIcons/exportimport.py
===================================================================
--- CMF/branches/1.6/CMFActionIcons/exportimport.py 2006-02-01 15:10:13 UTC (rev 41533)
+++ CMF/branches/1.6/CMFActionIcons/exportimport.py 2006-02-01 16:46:01 UTC (rev 41534)
@@ -60,7 +60,12 @@
ait_info = configurator.parseXML(body)
for action_icon in ait_info['action_icons']:
- ait.addActionIcon(**action_icon)
+ category = action_icon['category']
+ action_id = action_icon['action_id']
+ if ait.queryActionInfo(category, action_id) is not None:
+ ait.updateActionIcon(**action_icon)
+ else:
+ ait.addActionIcon(**action_icon)
return 'Action icons settings imported.'
Modified: CMF/branches/1.6/CMFActionIcons/tests/test_exportimport.py
===================================================================
--- CMF/branches/1.6/CMFActionIcons/tests/test_exportimport.py 2006-02-01 15:10:13 UTC (rev 41533)
+++ CMF/branches/1.6/CMFActionIcons/tests/test_exportimport.py 2006-02-01 16:46:01 UTC (rev 41534)
@@ -177,7 +177,30 @@
self.assertEqual(action_icon.getPriority(), self.PRIORITY)
self.assertEqual(action_icon.getExpression(), self.ICON_EXPR)
+ def test_nopurge(self):
+ from Products.CMFActionIcons.exportimport \
+ import importActionIconsTool
+ site = self._initSite(with_icon=True)
+ ait = site.portal_actionicons
+ ait.updateActionIcon(self.CATEGORY, self.ACTION_ID, 'somexpr',
+ title='foo', priority=123)
+ self.assertEqual(len(ait.listActionIcons()), 1)
+
+ context = DummyImportContext(site, purge=False)
+ context._files['actionicons.xml'] = self._WITH_ICON_EXPORT
+ importActionIconsTool(context)
+
+ self.assertEqual(len(ait.listActionIcons()), 1)
+ action_icon = ait.listActionIcons()[0]
+
+ self.assertEqual(action_icon.getCategory(), self.CATEGORY)
+ self.assertEqual(action_icon.getActionId(), self.ACTION_ID)
+ self.assertEqual(action_icon.getTitle(), self.TITLE)
+ self.assertEqual(action_icon.getPriority(), self.PRIORITY)
+ self.assertEqual(action_icon.getExpression(), self.ICON_EXPR)
+
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(ActionIconsToolExportConfiguratorTests),
More information about the CMF-checkins
mailing list