Commit aac2c5a4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: There is no need for `description` and `source_reference` to...

ZODB Components: There is no need for `description` and `source_reference` to be RecordedProperties.

* Not considered for `modified` state (dynamic_class_generation_interaction_workflow).
* `source_reference` sets only once at import from filesystem.
parent 9ee53625
Pipeline #11673 failed with stage
in 0 seconds
...@@ -83,7 +83,7 @@ class RecordablePropertyMetaClass(ExtensionClass): ...@@ -83,7 +83,7 @@ class RecordablePropertyMetaClass(ExtensionClass):
def getterWrapper(accessor_name, property_name, property_getter): def getterWrapper(accessor_name, property_name, property_getter):
dictionary['security'].declareProtected(Permissions.AccessContentsInformation, dictionary['security'].declareProtected(Permissions.AccessContentsInformation,
accessor_name) accessor_name)
if property_name in dictionary['_recorded_property_name_set']:
def getter(self, validated_only=False): def getter(self, validated_only=False):
""" """
When validated_only is True, then returns the property recorded if When validated_only is True, then returns the property recorded if
...@@ -100,18 +100,20 @@ class RecordablePropertyMetaClass(ExtensionClass): ...@@ -100,18 +100,20 @@ class RecordablePropertyMetaClass(ExtensionClass):
pass pass
return property_getter(self) return property_getter(self)
else:
getter = property_getter
getter.__name__ = accessor_name getter.__name__ = accessor_name
return getter return getter
for (property_name, for (property_name,
property_getter) in dictionary['_recorded_property_name_getter_dict'].iteritems(): property_getter) in dictionary['_property_name_getter_dict'].iteritems():
setter_name = '_set' + convertToUpperCase(property_name)
dictionary[setter_name] = setterWrapper(setter_name, property_name)
getter_name = 'get' + convertToUpperCase(property_name) getter_name = 'get' + convertToUpperCase(property_name)
dictionary[getter_name] = getterWrapper(getter_name, property_name, dictionary[getter_name] = getterWrapper(getter_name, property_name,
property_getter) property_getter)
if property_name in dictionary['_recorded_property_name_set']:
setter_name = '_set' + convertToUpperCase(property_name)
dictionary[setter_name] = setterWrapper(setter_name, property_name)
# docstring required for publishing any object # docstring required for publishing any object
dictionary['__doc__'] = metacls.__doc__ dictionary['__doc__'] = metacls.__doc__
...@@ -163,7 +165,11 @@ class ComponentMixin(PropertyRecordableMixin, Base): ...@@ -163,7 +165,11 @@ class ComponentMixin(PropertyRecordableMixin, Base):
'TextDocument', 'TextDocument',
'Component') 'Component')
_recorded_property_name_getter_dict = { _recorded_property_name_set = {'reference',
'version',
'text_content'}
_property_name_getter_dict = {
'reference': BaseAccessor.Getter('getReference', 'reference': BaseAccessor.Getter('getReference',
'reference', 'reference',
'string', 'string',
...@@ -302,7 +308,7 @@ class ComponentMixin(PropertyRecordableMixin, Base): ...@@ -302,7 +308,7 @@ class ComponentMixin(PropertyRecordableMixin, Base):
reference, version and text_content reference, version and text_content
""" """
if not self.checkConsistency(): if not self.checkConsistency():
for property_name in self._recorded_property_name_getter_dict: for property_name in self._recorded_property_name_set:
self.clearRecordedProperty(property_name) self.clearRecordedProperty(property_name)
self.validate() self.validate()
......
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