Commit a3ecc091 authored by Julien Muchembled's avatar Julien Muchembled

Remove some calls to deprecated functions

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29266 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d700d374
...@@ -2375,7 +2375,8 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -2375,7 +2375,8 @@ class ActionTemplateItem(ObjectTemplateItem):
obj = p.unrestrictedTraverse(url) obj = p.unrestrictedTraverse(url)
is_new_action = obj.getParentId() == 'portal_types' is_new_action = obj.getParentId() == 'portal_types'
id_id = is_new_action and 'reference' or 'id' id_id = is_new_action and 'reference' or 'id'
for action in obj.listActions(): for action in (is_new_action and obj.getActionInformationList
or obj.listActions)():
if getattr(action, id_id) == value: if getattr(action, id_id) == value:
break break
else: else:
......
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
# #
############################################################################## ##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.ERP5Type \ from Products.ERP5Type.ERP5Type \
import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
...@@ -44,6 +45,8 @@ class RoleDefinition(XMLObject): ...@@ -44,6 +45,8 @@ class RoleDefinition(XMLObject):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.ILocalRoleGenerator)
# Default Properties # Default Properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject , PropertySheet.XMLObject
......
...@@ -1215,15 +1215,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -1215,15 +1215,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
pt = self.getTypeTool() pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
object_pt.addAction( object_pt.newContent(portal_type='Action Information',
id = 'become_geek' reference='become_geek',
, name = 'Become Geek' title='Become Geek',
, action = 'become_geek_action' action='become_geek_action',
, condition = '' action_type='object_action',
, permission = ('View', ) float_index=2.0)
, category = 'object_action'
, visible = 1
, priority = 2.0 )
sequence.edit(first_action_id='become_geek') sequence.edit(first_action_id='become_geek')
def stepCreateEmptyAction(self, sequence=None, sequence_list=None, **kw): def stepCreateEmptyAction(self, sequence=None, sequence_list=None, **kw):
...@@ -1233,14 +1230,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -1233,14 +1230,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
pt = self.getTypeTool() pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
object_pt.addAction(id = '' object_pt.newContent(portal_type='Action Information',
, name = ' Nerd' title='Name',
, action = '' action_permission_list=(),
, condition = '' float_index=1.2)
, permission = ()
, category = ''
, visible = 1
, priority = 1.2)
def stepCreateSecondAction(self, sequence=None, sequence_list=None, **kw): def stepCreateSecondAction(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -1249,15 +1242,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -1249,15 +1242,12 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
pt = self.getTypeTool() pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id') object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id) object_pt = pt._getOb(object_id)
object_pt.addAction( object_pt.newContent(portal_type='Action Information',
id = 'become_nerd' reference='become_nerd',
, name = 'Become Nerd' title='Become Nerd',
, action = 'become_nerd_action' action='become_nerd_action',
, condition = '' action_type='object_action',
, permission = ('View', ) float_index=1.5)
, category = 'object_action'
, visible = 1
, priority = 1.5 )
sequence.edit(second_action_id='become_nerd') sequence.edit(second_action_id='become_nerd')
def stepCheckFirstActionExists(self, sequence=None, sequence_list=None, **kw): def stepCheckFirstActionExists(self, sequence=None, sequence_list=None, **kw):
......
...@@ -44,6 +44,7 @@ implements_tuple_list = [ ...@@ -44,6 +44,7 @@ implements_tuple_list = [
('BusinessPath', 'IBusinessPath'), ('BusinessPath', 'IBusinessPath'),
('BusinessPath', 'ICategoryAccessProvider'), ('BusinessPath', 'ICategoryAccessProvider'),
('DeliveryLine', 'IDivergenceSolver'), ('DeliveryLine', 'IDivergenceSolver'),
('RoleDefinition', 'ILocalRoleGenerator'),
('TradeCondition', 'ITransformation'), ('TradeCondition', 'ITransformation'),
('TradeModelCell', 'ITransformation'), ('TradeModelCell', 'ITransformation'),
('TradeModelCell', 'IVariated'), ('TradeModelCell', 'IVariated'),
......
...@@ -544,7 +544,6 @@ class ERP5TypeInformation(XMLObject, ...@@ -544,7 +544,6 @@ class ERP5TypeInformation(XMLObject,
security.declareProtected(Permissions.ModifyPortalContent, 'deleteActions') security.declareProtected(Permissions.ModifyPortalContent, 'deleteActions')
@deprecated @deprecated
def deleteActions(self, selections=(), REQUEST=None): def deleteActions(self, selections=(), REQUEST=None):
# XXX Should be deprecated.
action_list = self.listActions() action_list = self.listActions()
self.manage_delObjects([action_list[x].id for x in selections]) self.manage_delObjects([action_list[x].id for x in selections])
...@@ -553,7 +552,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -553,7 +552,7 @@ class ERP5TypeInformation(XMLObject,
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."""
return sorted(self.getActionInformationList(), return sorted(self.getActionInformationList(),
key=lambda x: x.getFloatIndex()) key=lambda x: (x.getFloatIndex(), x.getId()))
def _importOldAction(self, old_action): def _importOldAction(self, old_action):
from Products.ERP5Type.Document.ActionInformation import ActionInformation from Products.ERP5Type.Document.ActionInformation import ActionInformation
......
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