Commit eb0f1a1a authored by Julien Muchembled's avatar Julien Muchembled

Reuse manage_addTypeInformation in some places

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29268 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4f9c060a
No related merge requests found
...@@ -62,12 +62,14 @@ portal_types = portal.portal_types\n ...@@ -62,12 +62,14 @@ portal_types = portal.portal_types\n
object_portal_type_id = object_portal_type\n object_portal_type_id = object_portal_type\n
\n \n
# Create a new portal_type for the module\n # Create a new portal_type for the module\n
module_portal_type_value = portal_types.newContent(portal_type=\'Base Type\',\n portal_types.manage_addTypeInformation(\'ERP5 Type Information\',\n
id=module_portal_type,\n id=module_portal_type, typeinfo_name=\'ERP5Type: Folder (ERP5 Folder)\')\n
type_factory_method_id=\'addFolder\',\n module_portal_type_value = portal_types[module_portal_type]\n
# Set icon and allowed content types\n
module_portal_type_value.edit(\n
type_icon=\'folder_icon.gif\',\n type_icon=\'folder_icon.gif\',\n
type_filter_content_type=1,\n type_filter_content_type=1,\n
type_allowed_content_type=object_portal_type_id,\n type_allowed_content_type_list=(object_portal_type_id,),\n
type_group=\'module\')\n type_group=\'module\')\n
# initialize translation domains\n # initialize translation domains\n
module_portal_type_value.changeTranslations(\n module_portal_type_value.changeTranslations(\n
...@@ -174,9 +176,11 @@ form.manage_addField(\n ...@@ -174,9 +176,11 @@ form.manage_addField(\n
\n \n
\n \n
# Then add the portal_type corresponding to the new object\n # Then add the portal_type corresponding to the new object\n
object_portal_type_value = portal_types.newContent(portal_type=\'Base Type\',\n portal_types.manage_addTypeInformation(\'ERP5 Type Information\'\n
id=object_portal_type_id,\n , typeinfo_name = \'ERP5Type: XML Object (ERP5 XML Object)\'\n
type_factory_method_id=\'addXMLObject\')\n , id = object_portal_type_id\n
)\n
object_portal_type_value = portal_types[object_portal_type_id]\n
\n \n
# Chain to edit_workflow\n # Chain to edit_workflow\n
portal.portal_workflow.setChainForPortalTypes([object_portal_type_id],\n portal.portal_workflow.setChainForPortalTypes([object_portal_type_id],\n
...@@ -269,12 +273,12 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n ...@@ -269,12 +273,12 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>portal</string> <string>portal</string>
<string>portal_types</string> <string>portal_types</string>
<string>object_portal_type_id</string> <string>object_portal_type_id</string>
<string>_getitem_</string>
<string>module_portal_type_value</string> <string>module_portal_type_value</string>
<string>dict</string> <string>dict</string>
<string>module_list_form_id</string> <string>module_list_form_id</string>
<string>portal_skins_folder_name</string> <string>portal_skins_folder_name</string>
<string>portal_skins</string> <string>portal_skins</string>
<string>_getitem_</string>
<string>skin_folder</string> <string>skin_folder</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>skin_name</string> <string>skin_name</string>
......
66 74
\ No newline at end of file \ No newline at end of file
...@@ -526,9 +526,10 @@ class ERP5TypeInformation(XMLObject, ...@@ -526,9 +526,10 @@ class ERP5TypeInformation(XMLObject,
def addAction(self, id, name, action, condition, permission, category, def addAction(self, id, name, action, condition, permission, category,
icon=None, visible=1, priority=1.0, REQUEST=None, icon=None, visible=1, priority=1.0, REQUEST=None,
description=None): description=None):
# XXX Should be deprecated. newContent already does everything we want.
if isinstance(permission, basestring): if isinstance(permission, basestring):
permission = permission, permission = permission,
if isinstance(action, str) and action[:7] not in ('string:', 'python:'):
value = 'string:${object_url}/' + value
self.newContent(portal_type='Action Information', self.newContent(portal_type='Action Information',
reference=id, reference=id,
title=name, title=name,
......
...@@ -116,7 +116,8 @@ class TypesTool(BaseTool, CMFCore_TypesTool.TypesTool): ...@@ -116,7 +116,8 @@ class TypesTool(BaseTool, CMFCore_TypesTool.TypesTool):
raise ValueError('An id is required.') raise ValueError('An id is required.')
type_info = self.newContent(id, 'Base Type') type_info = self.newContent(id, 'Base Type')
if fti: if fti:
type_info.__dict__.update(**fti) type_info.__dict__.update((k, v) for k, v in fti.iteritems()
if k not in ('id', 'actions'))
# Compatibility code to access old "ERP5 Role Information" objects. # Compatibility code to access old "ERP5 Role Information" objects.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment