Commit 89e254cf authored by Julien Muchembled's avatar Julien Muchembled

Optimimize and split _updateLocalRolesOnObject. Rename get{Action,Role}List.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29250 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e98be8d
No related merge requests found
......@@ -2463,7 +2463,7 @@ class ActionTemplateItem(ObjectTemplateItem):
for path, action_dict in portal_type_dict.iteritems():
container = p.unrestrictedTraverse(path)
container.manage_delObjects([obj.id
for obj in container.getActionList()
for obj in container.getActionInformationList()
if obj.reference in action_dict])
for obj in action_dict.itervalues():
container._importOldAction(obj)
......@@ -2544,7 +2544,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
obj = p.unrestrictedTraverse("portal_types/%s" %
relative_url.split('/', 1)[1])
self._objects[relative_url] = type_role_list = []
for role in obj.getRoleList():
for role in obj.getRoleInformationList():
type_role_dict = {}
for k, v in aq_base(role).__getstate__().iteritems():
if k == 'condition':
......@@ -2647,7 +2647,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
obj = p.unrestrictedTraverse(path, None)
if obj is not None:
# reset roles before applying
obj.manage_delObjects([x.id for x in obj.getRoleList()])
obj.manage_delObjects([x.id for x in obj.getRoleInformationList()])
type_roles_list = self._objects[roles_path] or []
for role_property_dict in type_roles_list:
obj._importRole(role_property_dict)
......
......@@ -378,7 +378,7 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
base_cat.manage_delObjects(list(base_cat.objectIds()))
# clear role definitions
for ti in self.getTypesTool().objectValues():
ti.manage_delObjects([x.id for x in ti.getRoleList()])
ti.manage_delObjects([x.id for x in ti.getRoleInformationList()])
# clear modules
for module in self.portal.objectValues():
if module.getId().endswith('_module'):
......
......@@ -73,15 +73,15 @@ class ActionInformation(XMLObject):
def _setActionExpression(self, value):
if isinstance(value, basestring):
value = Expression(value)
value = value and Expression(value) or None
self._baseSetActionExpression(value)
def _setCondition(self, value):
if isinstance(value, basestring):
value = Expression(value)
value = value and Expression(value) or None
self._baseSetCondition(value)
def _setIcon(self, value):
if isinstance(value, basestring):
value = Expression(value)
value = value and Expression(value) or None
self._baseSetIcon(value)
def getCondition(self):
......
This diff is collapsed.
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