Commit a998eeae authored by Vincent Pelletier's avatar Vincent Pelletier

Replace hasattr(x, y) by getattr(x, y, None).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12822 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ae52015b
...@@ -2236,8 +2236,8 @@ class Base( CopyContainer, ...@@ -2236,8 +2236,8 @@ class Base( CopyContainer,
# can return a new predicate. # can return a new predicate.
for script_name_begin in [self.getPortalType(), self.getMetaType(), self.__class__.__name__]: for script_name_begin in [self.getPortalType(), self.getMetaType(), self.__class__.__name__]:
script_name = join([script_name_begin.replace(' ',''), script_name_end ], '') script_name = join([script_name_begin.replace(' ',''), script_name_end ], '')
if hasattr(self, script_name): script = getattr(self, script_name, None)
script = getattr(self, script_name) if script is not None:
break break
if script is None and fallback_script_id is not None: if script is None and fallback_script_id is not None:
script = getattr(self, fallback_script_id) script = getattr(self, fallback_script_id)
......
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