Commit 6a869c37 authored by Sebastien Robin's avatar Sebastien Robin

allow to use properties of type list in acquisitions (acquired_property_id)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2948 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a0705232
...@@ -1413,6 +1413,12 @@ def createDefaultAccessors(klass, id, prop = None): ...@@ -1413,6 +1413,12 @@ def createDefaultAccessors(klass, id, prop = None):
if not hasattr(klass, accessor_name) or prop.get('override',0): if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor) setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.AccessContentsInformation, accessor_name ) klass.security.declareProtected( Permissions.AccessContentsInformation, accessor_name )
accessor_name = 'get' + UpperCase(composed_id) + 'List'
base_accessor = ContentProperty.Getter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'))
if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.AccessContentsInformation, accessor_name )
# No default getter YET XXXXXXXXXXXXXX # No default getter YET XXXXXXXXXXXXXX
# No list getter YET XXXXXXXXXXXXXX # No list getter YET XXXXXXXXXXXXXX
accessor_name = '_set' + UpperCase(composed_id) accessor_name = '_set' + UpperCase(composed_id)
...@@ -1421,12 +1427,24 @@ def createDefaultAccessors(klass, id, prop = None): ...@@ -1421,12 +1427,24 @@ def createDefaultAccessors(klass, id, prop = None):
if not hasattr(klass, accessor_name) or prop.get('override',0): if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor) setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name ) klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name )
accessor_name = '_set' + UpperCase(composed_id) + 'List'
base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=0)
if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name )
accessor_name = 'set' + UpperCase(composed_id) accessor_name = 'set' + UpperCase(composed_id)
base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id, base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id,
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1) portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1)
if not hasattr(klass, accessor_name) or prop.get('override',0): if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor) setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name ) klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name )
accessor_name = 'set' + UpperCase(composed_id) + 'List'
base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1)
if not hasattr(klass, accessor_name) or prop.get('override',0):
setattr(klass, accessor_name, base_accessor)
klass.security.declareProtected( Permissions.ModifyPortalContent, accessor_name )
# No default getter YET XXXXXXXXXXXXXX # No default getter YET XXXXXXXXXXXXXX
# No list getter YET XXXXXXXXXXXXXX # No list getter YET XXXXXXXXXXXXXX
elif prop['type'] == 'object': elif prop['type'] == 'object':
......
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