From 57ed4dd4fd303ac60d151a5eed0435e753d1c9a1 Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sun, 20 Jul 2008 13:29:35 +0000
Subject: [PATCH] Use getattr instead of hasattr

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22576 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Base.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index 462a233e8c..e450a146ef 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -1410,14 +1410,14 @@ class Base( CopyContainer,
       return
     # Try to get a portal_type property (Implementation Dependent)
     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
-    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)
       # LOG("Base.py", 0, "method = %s, name = %s" %(method, accessor_name))
       method(value, **kw)
       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(value, **kw)
       return
-- 
2.30.9