Commit 4abb1c86 authored by Julien Muchembled's avatar Julien Muchembled

Add compatibility code and the wizard to create a module

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29248 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 48acc068
57 60
\ No newline at end of file \ No newline at end of file
...@@ -644,6 +644,31 @@ class ERP5TypeInformation(XMLObject, ...@@ -644,6 +644,31 @@ class ERP5TypeInformation(XMLObject,
# Compatibitility code for actions # Compatibitility code for actions
# #
security.declareProtected(Permissions.ModifyPortalContent, 'addAction')
def addAction(self, id, name, action, condition, permission, category,
icon=None, visible=1, priority=1.0, REQUEST=None,
description=None):
# XXX Should be deprecated. newContent already does everything we want.
if isinstance(permission, basestring):
permission = permission,
self.newContent(portal_type='Action Information',
reference=id,
title=name,
action=action,
condition=condition,
permission_list=permission,
action_type=category,
icon=icon,
visible=visible,
float_index=priority,
description=description)
security.declareProtected(Permissions.ModifyPortalContent, 'deleteActions')
def deleteActions(self, selections=(), REQUEST=None):
# XXX Should be deprecated.
action_list = self.listActions()
self.manage_delObjects([action_list[x].id for x in selections])
security.declarePrivate('listActions') security.declarePrivate('listActions')
def listActions(self, info=None, object=None): def listActions(self, info=None, object=None):
""" List all the actions defined by a provider.""" """ List all the actions defined by a provider."""
......
...@@ -33,6 +33,11 @@ class BaseType: ...@@ -33,6 +33,11 @@ class BaseType:
""" """
_properties = ( _properties = (
{ 'id': 'type_icon',
'storage_id': 'content_icon', # CMF Compatibility
'type': 'string',
'mode': 'w',
},
{ 'id': 'type_factory_method_id', { 'id': 'type_factory_method_id',
'storage_id': 'factory', # CMF Compatibility 'storage_id': 'factory', # CMF Compatibility
'type': 'string', 'type': 'string',
......
...@@ -26,6 +26,7 @@ import Products ...@@ -26,6 +26,7 @@ import Products
from zLOG import LOG from zLOG import LOG
_MARKER = {}
class PropertyDomainDict(Implicit): class PropertyDomainDict(Implicit):
""" """
...@@ -100,14 +101,14 @@ class TranslationProviderBase: ...@@ -100,14 +101,14 @@ class TranslationProviderBase:
property_domain_dict[prop_id] = TranslationInformation(prop_id, domain_name) property_domain_dict[prop_id] = TranslationInformation(prop_id, domain_name)
original_property_domain_dict = getattr(aq_base(self), original_property_domain_dict = getattr(aq_base(self),
'_property_domain_dict', None) '_property_domain_dict', _MARKER)
original_property_domain_keys = original_property_domain_dict.keys() original_property_domain_keys = original_property_domain_dict.keys()
property_domain_keys = property_domain_dict.keys() property_domain_keys = property_domain_dict.keys()
property_domain_keys.sort() property_domain_keys.sort()
original_property_domain_keys.sort() original_property_domain_keys.sort()
# Only update if required in order to prevent ZODB from growing # Only update if required in order to prevent ZODB from growing
if original_property_domain_dict is None or \ if original_property_domain_dict is _MARKER or\
property_domain_keys != original_property_domain_keys: property_domain_keys != original_property_domain_keys:
# Update existing dict # Update existing dict
property_domain_dict.update(original_property_domain_dict) property_domain_dict.update(original_property_domain_dict)
...@@ -169,7 +170,7 @@ class TranslationProviderBase: ...@@ -169,7 +170,7 @@ class TranslationProviderBase:
new_domain_name = properties.get(prop_name) new_domain_name = properties.get(prop_name)
prop_object = property_domain_dict[prop_name] prop_object = property_domain_dict[prop_name]
if new_domain_name != prop_object.getDomainName(): if new_domain_name != prop_object.getDomainName():
prop_object.setDomainName(new_domain_name) prop_object.edit(domain_name=new_domain_name)
from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.Base import _aq_reset
_aq_reset() # Reset accessor cache _aq_reset() # Reset accessor cache
......
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