Commit 7955aa81 authored by Julien Muchembled's avatar Julien Muchembled

Do not use spec/meta_type of object{Ids,Values}

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29246 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59ccb88d
...@@ -2463,7 +2463,7 @@ class ActionTemplateItem(ObjectTemplateItem): ...@@ -2463,7 +2463,7 @@ class ActionTemplateItem(ObjectTemplateItem):
for path, action_dict in portal_type_dict.iteritems(): for path, action_dict in portal_type_dict.iteritems():
container = p.unrestrictedTraverse(path) container = p.unrestrictedTraverse(path)
container.manage_delObjects([obj.id container.manage_delObjects([obj.id
for obj in container.objectValues(meta_type='ERP5 Action Information') for obj in container.objectValues(portal_type='Action Information')
if obj.reference in action_dict]) if obj.reference in action_dict])
for obj in action_dict.itervalues(): for obj in action_dict.itervalues():
container._importOldAction(obj) container._importOldAction(obj)
...@@ -2544,7 +2544,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem): ...@@ -2544,7 +2544,7 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
obj = p.unrestrictedTraverse("portal_types/%s" % obj = p.unrestrictedTraverse("portal_types/%s" %
relative_url.split('/', 1)[1]) relative_url.split('/', 1)[1])
self._objects[relative_url] = type_role_list = [] self._objects[relative_url] = type_role_list = []
for role in obj.objectValues(meta_type='ERP5 Role Information'): for role in obj.objectValues(portal_type='Role Information'):
type_role_dict = {} type_role_dict = {}
for k, v in aq_base(role).__getstate__().iteritems(): for k, v in aq_base(role).__getstate__().iteritems():
if k == 'condition': if k == 'condition':
...@@ -2647,8 +2647,8 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem): ...@@ -2647,8 +2647,8 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
obj = p.unrestrictedTraverse(path, None) obj = p.unrestrictedTraverse(path, None)
if obj is not None: if obj is not None:
# reset roles before applying # reset roles before applying
obj.manage_delObjects(list( obj.manage_delObjects([x.id
obj.objectIds(spec='ERP5 Role Information'))) for x in obj.objectValues(portal_type='Role Information')])
type_roles_list = self._objects[roles_path] or [] type_roles_list = self._objects[roles_path] or []
for role_property_dict in type_roles_list: for role_property_dict in type_roles_list:
obj._importRole(role_property_dict) obj._importRole(role_property_dict)
......
...@@ -378,7 +378,8 @@ class TestLocalRoleManagement(ERP5TypeTestCase): ...@@ -378,7 +378,8 @@ class TestLocalRoleManagement(ERP5TypeTestCase):
base_cat.manage_delObjects(list(base_cat.objectIds())) base_cat.manage_delObjects(list(base_cat.objectIds()))
# clear role definitions # clear role definitions
for ti in self.getTypesTool().objectValues(): for ti in self.getTypesTool().objectValues():
ti.manage_delObjects(list(ti.objectIds(spec='ERP5 Role Information'))) ti.manage_delObjects([x.id
for x in ti.objectValues(portal_type='ERP5 Role Information')])
# clear modules # clear modules
for module in self.portal.objectValues(): for module in self.portal.objectValues():
if module.getId().endswith('_module'): if module.getId().endswith('_module'):
......
...@@ -245,7 +245,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -245,7 +245,7 @@ class ERP5TypeInformation(XMLObject,
# which acquire their security definition from their parent # which acquire their security definition from their parent
# The downside of this optimisation is that it is not possible to # The downside of this optimisation is that it is not possible to
# set a local role definition if the local role list is empty # set a local role definition if the local role list is empty
if len(self.objectValues(meta_type='ERP5 Role Information')): if len(self.objectValues(portal_type='Role Information')):
self.updateLocalRolesOnObject(ob) self.updateLocalRolesOnObject(ob)
# notify workflow after generating local roles, in order to prevent # notify workflow after generating local roles, in order to prevent
...@@ -528,7 +528,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -528,7 +528,7 @@ class ERP5TypeInformation(XMLObject,
folder = aq_parent(folder) folder = aq_parent(folder)
ec = createExprContext(folder, portal, ob) ec = createExprContext(folder, portal, ob)
for role in self.objectValues(meta_type='ERP5 Role Information'): for role in self.objectValues(portal_type='Role Information'):
if role.testCondition(ec): if role.testCondition(ec):
yield role yield role
......
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