From 33aa27dbb30b4dfba9cf7f4d50c70ed6667091fe Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Sun, 3 Jan 2010 15:08:11 +0100 Subject: [PATCH] [imp] replace hasattr-based conditionals by getattrs bzr revid: xmo@tinyerp.com-20100103140811-0xnljbidnvomstg0 --- bin/netsvc.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index 91630563452..e0e97efe28d 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -364,10 +364,7 @@ class OpenERPDispatcher: self.log('service', service_name) self.log('method', method) self.log('params', params) - if hasattr(self,'auth_provider'): - auth = self.auth_provider - else: - auth = None + auth = getattr(self, 'auth_provider', None) result = ExportService.getService(service_name).dispatch(method, auth, params) self.log('result', result) # We shouldn't marshall None, @@ -376,10 +373,7 @@ class OpenERPDispatcher: return result except Exception, e: self.log('exception', tools.exception_to_unicode(e)) - if hasattr(e, 'traceback'): - tb = e.traceback - else: - tb = sys.exc_info() + tb = getattr(e, 'traceback', sys.exc_info()) tb_s = "".join(traceback.format_exception(*tb)) if tools.config['debug_mode']: import pdb