[imp] replace hasattr-based conditionals by getattrs

bzr revid: xmo@tinyerp.com-20100103140811-0xnljbidnvomstg0
This commit is contained in:
Xavier Morel 2010-01-03 15:08:11 +01:00
parent 3077e048eb
commit 33aa27dbb3
1 changed files with 2 additions and 8 deletions

View File

@ -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