Commit 9a4529b4 authored by Jérome Perrin's avatar Jérome Perrin

generate aquired properties accessors for subobject with default_ prefix

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6839 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent efb4a67b
...@@ -1568,49 +1568,47 @@ def createDefaultAccessors(property_holder, id, prop = None, ...@@ -1568,49 +1568,47 @@ def createDefaultAccessors(property_holder, id, prop = None,
setattr(property_holder, accessor_name, list_accessor.dummy_copy(accessor_name)) setattr(property_holder, accessor_name, list_accessor.dummy_copy(accessor_name))
if prop.has_key('acquired_property_id'): if prop.has_key('acquired_property_id'):
for aq_id in prop['acquired_property_id']: for aq_id in prop['acquired_property_id']:
composed_id = "%s_%s" % (id, aq_id) for composed_id in ("%s_%s" % (id, aq_id), "default_%s_%s" % (id, aq_id)) :
# print "Set composed_id accessor %s" % composed_id accessor_name = 'get' + UpperCase(composed_id)
accessor_name = 'get' + UpperCase(composed_id) base_accessor = ContentProperty.Getter(accessor_name, composed_id, prop['type'], aq_id,
# print "Set accessor_name accessor %s" % accessor_name portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'))
base_accessor = ContentProperty.Getter(accessor_name, composed_id, prop['type'], aq_id, if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id')) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( read_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) accessor_name = 'get' + UpperCase(composed_id) + 'List'
property_holder.security.declareProtected( read_permission, accessor_name ) base_accessor = ContentProperty.Getter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
accessor_name = 'get' + UpperCase(composed_id) + 'List' portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'))
base_accessor = ContentProperty.Getter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list', if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id')) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( read_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) # No default getter YET XXXXXXXXXXXXXX
property_holder.security.declareProtected( read_permission, accessor_name ) # No list getter YET XXXXXXXXXXXXXX
# No default getter YET XXXXXXXXXXXXXX accessor_name = '_set' + UpperCase(composed_id)
# No list getter YET XXXXXXXXXXXXXX base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id,
accessor_name = '_set' + UpperCase(composed_id) portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=0)
base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id, if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=0) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( write_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) accessor_name = '_set' + UpperCase(composed_id) + 'List'
property_holder.security.declareProtected( write_permission, accessor_name ) base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
accessor_name = '_set' + UpperCase(composed_id) + 'List' portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=0)
base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list', if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=0) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( write_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) accessor_name = 'set' + UpperCase(composed_id)
property_holder.security.declareProtected( write_permission, accessor_name ) base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id,
accessor_name = 'set' + UpperCase(composed_id) portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1)
base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id, if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( write_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) accessor_name = 'set' + UpperCase(composed_id) + 'List'
property_holder.security.declareProtected( write_permission, accessor_name ) base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list',
accessor_name = 'set' + UpperCase(composed_id) + 'List' portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1)
base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list', if not hasattr(property_holder, accessor_name) or prop.get('override',0):
portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1) setattr(property_holder, accessor_name, base_accessor)
if not hasattr(property_holder, accessor_name) or prop.get('override',0): property_holder.security.declareProtected( write_permission, accessor_name )
setattr(property_holder, accessor_name, base_accessor) # No default getter YET XXXXXXXXXXXXXX
property_holder.security.declareProtected( write_permission, accessor_name ) # No list getter YET XXXXXXXXXXXXXX
# No default getter YET XXXXXXXXXXXXXX
# No list getter YET XXXXXXXXXXXXXX
elif prop['type'] == 'object': elif prop['type'] == 'object':
# Create url getters for an object property # Create url getters for an object property
accessor_name = 'get' + UpperCase(id) accessor_name = 'get' + UpperCase(id)
......
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