Commit 5ae33020 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Accessors: Return the default value of the Property which is acquired.

Rather than the acquired Property.
parent 15805d6c
...@@ -156,12 +156,16 @@ class Getter(Base.Getter): ...@@ -156,12 +156,16 @@ class Getter(Base.Getter):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the first available object in the list # We return the first available object in the list
if args:
default_result = args[0]
else:
default_result = self._default
o = None o = None
for k in self._storage_id_list: for k in self._storage_id_list:
o = getattr(instance, k, None) o = getattr(instance, k, None)
if o is not None and o.portal_type in self._portal_type: if o is not None and o.portal_type in self._portal_type:
return o.getProperty(self._acquired_property, *args, **kw) return o.getProperty(self._acquired_property, default_result, **kw)
return args[0] if args else self._default return default_result
psyco.bind(__call__) psyco.bind(__call__)
......
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