Commit 57ed4dd4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Use getattr instead of hasattr

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22576 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cdf66945
...@@ -1410,14 +1410,14 @@ class Base( CopyContainer, ...@@ -1410,14 +1410,14 @@ class Base( CopyContainer,
return return
# Try to get a portal_type property (Implementation Dependent) # Try to get a portal_type property (Implementation Dependent)
aq_key = self._aq_key() aq_key = self._aq_key()
if not Base.aq_portal_type.has_key(aq_key): if getattr(Base.aq_portal_type, aq_key, None) is not None:
self._aq_dynamic('id') # Make sure _aq_dynamic has been called once self._aq_dynamic('id') # Make sure _aq_dynamic has been called once
if hasattr(Base.aq_portal_type[aq_key], accessor_name): if getattr(Base.aq_portal_type[aq_key], accessor_name, None) is not None:
method = getattr(self, accessor_name) method = getattr(self, accessor_name)
# LOG("Base.py", 0, "method = %s, name = %s" %(method, accessor_name)) # LOG("Base.py", 0, "method = %s, name = %s" %(method, accessor_name))
method(value, **kw) method(value, **kw)
return return
if hasattr(Base.aq_portal_type[aq_key], public_accessor_name): if getattr(Base.aq_portal_type[aq_key], public_accessor_name, None) is not None:
method = getattr(self, public_accessor_name) method = getattr(self, public_accessor_name)
method(value, **kw) method(value, **kw)
return return
......
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