Commit 4bfe6131 authored by Jérome Perrin's avatar Jérome Perrin

Quick patch to make getSourceReference and getDestinationReference be some

property accessors like they were prior to property sheets as ERP5 documents.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44333 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cd05616e
......@@ -28,6 +28,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type import SOURCE_DESTINATION_REFERENCE_LEGACY
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Accessor.Base import Getter as BaseGetter
......@@ -198,7 +199,11 @@ class CategoryProperty(IdAsReferenceMixin('_category'), XMLObject):
# then getters
for id_format, accessor_class in cls.getter_definition_dict.iteritems():
accessor_name = id_format % uppercase_category_id
# XXX getSourceReference/getDestinationReference are already generated by
# 'source_reference' and 'destination_reference' standard properties. To
# prevent name conflict, we don't generate them as a category accessor.
if not (SOURCE_DESTINATION_REFERENCE_LEGACY and accessor_name in (
'getSourceReference', 'getDestinationReference')):
public_accessor = accessor_class(accessor_name, category_id)
accessor_holder.registerAccessor(public_accessor, read_permission)
......@@ -211,6 +216,12 @@ class CategoryProperty(IdAsReferenceMixin('_category'), XMLObject):
# and setters
for id_format, accessor_class in cls.setter_definition_dict.iteritems():
accessor_name = id_format % uppercase_category_id
# XXX setSourceReference/setDestinationReference are already generated by
# 'source_reference' and 'destination_reference' standard properties. To
# prevent name conflict, we don't generate them as a category accessor.
if SOURCE_DESTINATION_REFERENCE_LEGACY and accessor_name in (
'setSourceReference', 'setDestinationReference'):
continue
accessor = accessor_class(accessor_name, category_id)
accessor_holder.registerAccessor(accessor, write_permission)
......
......@@ -34,6 +34,14 @@ from patches import python
from zLOG import LOG, INFO
DISPLAY_BOOT_PROCESS = False
# We have a name conflict with source_reference and destination_reference,
# which are at the same time property accessors for 'source_reference'
# property, and category accessors (similar to getSourceValue().getReference())
# When this is set to True, those accessors will be the property accessors.
# At the time beeing, if it's set to False for document having both category
# and property, the result seem to be undefined.
SOURCE_DESTINATION_REFERENCE_LEGACY = True
# This is used to register all Document classes used in ERP5
# items are class names, values are class paths, e.g.:
# 'Person' -> 'Products.ERP5.Document.Person.Person'
......
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