[CMF-checkins] SVN: CMF/trunk/CMFActionIcons/ Merged 41534 from 1.6
branch:
Florent Guillaume
fg at nuxeo.com
Wed Feb 1 11:47:54 EST 2006
Log message for revision 41535:
Merged 41534 from 1.6 branch:
Fixed import of action icons in extension profiles.
Changed:
U CMF/trunk/CMFActionIcons/exportimport.py
U CMF/trunk/CMFActionIcons/tests/test_exportimport.py
-=-
Modified: CMF/trunk/CMFActionIcons/exportimport.py
===================================================================
--- CMF/trunk/CMFActionIcons/exportimport.py 2006-02-01 16:46:01 UTC (rev 41534)
+++ CMF/trunk/CMFActionIcons/exportimport.py 2006-02-01 16:47:54 UTC (rev 41535)
@@ -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/trunk/CMFActionIcons/tests/test_exportimport.py
===================================================================
--- CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2006-02-01 16:46:01 UTC (rev 41534)
+++ CMF/trunk/CMFActionIcons/tests/test_exportimport.py 2006-02-01 16:47:54 UTC (rev 41535)
@@ -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