Commit bdf92857 authored by Jérome Perrin's avatar Jérome Perrin

use getattr instead of hasattr


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15738 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3afd86e
...@@ -945,12 +945,12 @@ class Base( CopyContainer, ...@@ -945,12 +945,12 @@ class Base( CopyContainer,
# We must use aq_self # We must use aq_self
# since we will change the value on self # since we will change the value on self
# rather than through implicit aquisition # rather than through implicit aquisition
if hasattr(aq_self, accessor_name): if getattr(aq_self, accessor_name, None) is not None:
method = getattr(self, accessor_name) method = getattr(self, accessor_name)
method(value, **kw) method(value, **kw)
return return
public_accessor_name = 'set' + UpperCase(key) public_accessor_name = 'set' + UpperCase(key)
if hasattr(aq_self, public_accessor_name): if getattr(aq_self, 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