[Checkins] SVN: Products.CMFCore/branches/2.2/Products/CMFCore/ Add GenericSetup export/import support for type information action
Ross Patterson
cvs-admin at zope.org
Thu Apr 26 21:05:59 UTC 2012
Log message for revision 125311:
Add GenericSetup export/import support for type information action
descriptions.
Changed:
U Products.CMFCore/branches/2.2/Products/CMFCore/ActionProviderBase.py
U Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
U Products.CMFCore/branches/2.2/Products/CMFCore/TypesTool.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/tests/test_typeinfo.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py
-=-
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/ActionProviderBase.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/ActionProviderBase.py 2012-04-26 18:46:30 UTC (rev 125310)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/ActionProviderBase.py 2012-04-26 21:05:55 UTC (rev 125311)
@@ -180,6 +180,7 @@
, visible=1
, icon_expr=''
, link_target=''
+ , description=''
, REQUEST=None
):
""" Add an action to our list.
@@ -197,6 +198,7 @@
new_action = ActionInformation( id=str(id)
, title=str(name)
+ , description=str(description)
, category=str(category)
, condition=condition
, permissions=permission
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt 2012-04-26 18:46:30 UTC (rev 125310)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt 2012-04-26 21:05:55 UTC (rev 125311)
@@ -4,7 +4,10 @@
2.2.7 (unreleased)
------------------
+- Add GenericSetup export/import support for type information action
+ descriptions.
+
2.2.6 (2012-04-15)
------------------
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/TypesTool.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/TypesTool.py 2012-04-26 18:46:30 UTC (rev 125310)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/TypesTool.py 2012-04-26 21:05:55 UTC (rev 125311)
@@ -171,6 +171,7 @@
, visible=action.get('visible', True)
, icon_expr=action.get('icon_expr', '')
, link_target=action.get('link_target', '')
+ , description=action.get('description', '')
)
self.setMethodAliases(kw.get('aliases', {}))
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/tests/test_typeinfo.py 2012-04-26 18:46:30 UTC (rev 125310)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/tests/test_typeinfo.py 2012-04-26 21:05:55 UTC (rev 125311)
@@ -51,8 +51,9 @@
<alias from="(Default)" to="foo"/>
<alias from="view" to="foo"/>
<action title="Foo" action_id="foo_action" category="Bar"
- condition_expr="python:1" icon_expr="string:${portal_url}/icon.png"
- link_target="" url_expr="string:${object_url}/foo" visible="True"/>
+ condition_expr="python:1" description="Foo action description"
+ icon_expr="string:${portal_url}/icon.png" link_target=""
+ url_expr="string:${object_url}/foo" visible="True"/>
</object>
"""
@@ -85,6 +86,7 @@
},
'actions': ({'id': 'view',
'title': 'View',
+ 'description': 'View the current item.',
'action': 'string:${object_url}/foo_view',
'icon_expr': 'string:${portal_url}/preview_icon.png',
'link_target': '_new',
@@ -98,6 +100,7 @@
},
{'id': 'metadata',
'title': 'Metadata',
+ 'description': "Manage the item's metadata",
'action': 'string:${object_url}/metadata_edit_form',
'icon_expr': 'string:${portal_url}/metadata_icon.png',
'permissions': (ModifyPortalContent,),
@@ -128,6 +131,7 @@
},
{'id': 'edit',
'title': 'Edit',
+ 'description': 'Edit the current item.',
'action': 'string:${object_url}/bar_edit_form',
'permissions': (ModifyPortalContent,),
},
@@ -202,19 +206,21 @@
<property name="allow_discussion">False</property>
<alias from="(Default)" to="foo_view"/>
<alias from="view" to="foo_view"/>
- <action title="View" action_id="view" category="object" condition_expr=""
+ <action title="View" description="View the current item."
+ action_id="view" category="object" condition_expr=""
url_expr="string:${object_url}/foo_view"
icon_expr="string:${portal_url}/preview_icon.png" link_target="_new"
visible="True">
<permission value="View"/>
</action>
- <action title="Edit" action_id="edit" category="object" condition_expr=""
- url_expr="string:${object_url}/foo_edit_form"
+ <action title="Edit" action_id="edit" category="object" condition_expr=""
+ description="" url_expr="string:${object_url}/foo_edit_form"
icon_expr="string:${portal_url}/edit_icon.png" link_target=""
visible="True">
<permission value="Modify portal content"/>
</action>
- <action title="Metadata" action_id="metadata" category="object"
+ <action title="Metadata" description="Manage the item's metadata"
+ action_id="metadata" category="object"
condition_expr="" url_expr="string:${object_url}/metadata_edit_form"
icon_expr="string:${portal_url}/metadata_icon.png" link_target=""
visible="True">
@@ -244,23 +250,27 @@
<property name="allow_discussion">True</property>
<alias from="(Default)" to="bar_view"/>
<alias from="view" to="bar_view"/>
- <action title="View" action_id="view" category="object" condition_expr=""
+ <action title="View" description="" action_id="view"
+ category="object" condition_expr=""
url_expr="string:${object_url}/bar_view"
icon_expr="" link_target="" visible="True">
<permission value="View"/>
</action>
- <action title="Edit" action_id="edit" category="object" condition_expr=""
+ <action title="Edit" description="Edit the current item."
+ action_id="edit" category="object" condition_expr=""
url_expr="string:${object_url}/bar_edit_form"
icon_expr="" link_target="" visible="True">
<permission value="Modify portal content"/>
</action>
- <action title="Contents" action_id="contents" category="object"
- condition_expr="" url_expr="string:${object_url}/folder_contents"
+ <action title="Contents" description="" action_id="contents"
+ category="object" condition_expr=""
+ url_expr="string:${object_url}/folder_contents"
icon_expr="" link_target="" visible="True">
<permission value="Access contents information"/>
</action>
- <action title="Metadata" action_id="metadata" category="object"
- condition_expr="" url_expr="string:${object_url}/metadata_edit_form"
+ <action title="Metadata" description="" action_id="metadata"
+ category="object" condition_expr=""
+ url_expr="string:${object_url}/metadata_edit_form"
icon_expr="" link_target="" visible="True">
<permission value="Modify portal content"/>
</action>
@@ -331,9 +341,10 @@
def _populate(self, obj):
obj.setMethodAliases({'(Default)': 'foo', 'view': 'foo'})
- obj.addAction('foo_action', 'Foo', 'string:${object_url}/foo',
- 'python:1', (), 'Bar',
- icon_expr="string:${portal_url}/icon.png")
+ obj.addAction('foo_action', 'Foo',
+ 'string:${object_url}/foo', 'python:1', (), 'Bar',
+ icon_expr="string:${portal_url}/icon.png",
+ description='Foo action description')
def _verifyImport(self, obj):
self.assertEqual(type(obj._aliases), dict)
@@ -346,7 +357,7 @@
self.assertEqual(type(obj._actions[0].title), str)
self.assertEqual(obj._actions[0].title, 'Foo')
self.assertEqual(type(obj._actions[0].description), str)
- self.assertEqual(obj._actions[0].description, '')
+ self.assertEqual(obj._actions[0].description, 'Foo action description')
self.assertEqual(type(obj._actions[0].category), str)
self.assertEqual(obj._actions[0].category, 'Bar')
self.assertEqual(type(obj._actions[0].condition.text), str)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py 2012-04-26 18:46:30 UTC (rev 125310)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py 2012-04-26 21:05:55 UTC (rev 125311)
@@ -113,6 +113,7 @@
ai_info = ai.getMapping()
child = self._doc.createElement('action')
child.setAttribute('title', ai_info['title'])
+ child.setAttribute('description', ai_info['description'])
child.setAttribute('action_id', ai_info['id'])
child.setAttribute('category', ai_info['category'])
child.setAttribute('condition_expr', ai_info['condition'])
@@ -136,6 +137,7 @@
continue
title = str(child.getAttribute('title'))
id = str(child.getAttribute('action_id'))
+ description = str(child.getAttribute('description'))
category = str(child.getAttribute('category'))
condition = str(child.getAttribute('condition_expr'))
action = str(child.getAttribute('url_expr'))
@@ -165,10 +167,12 @@
self.context.addAction(id, title, action, condition,
tuple(permissions), category, visible,
icon_expr=icon_expr,
- link_target=link_target)
+ link_target=link_target,
+ description=description)
else:
- action_obj.edit(title=title, action=action,
- icon_expr=icon_expr, condition=condition,
+ action_obj.edit(title=title, description=description,
+ action=action, icon_expr=icon_expr,
+ condition=condition,
permissions=tuple(permissions),
visible=visible, link_target=link_target)
More information about the checkins
mailing list