Raise exption in browse record when field doesn't exist

Log traceback on abort_response if verbose is set
This commit is contained in:
Cédric Krier committed 2008-05-20 10:15:26 +02:00
1 parent fdef99718a
commit 0224d31333
2 files changed
+9 -7

No files matched your search

+6
View File
@@ -46,6 +46,12 @@ class Service(object):
self.method[method.__name__] = method
def abort_response(self, description, origin, details):
if CONFIG['verbose']:
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(
sys.exc_type, sys.exc_value, sys.exc_traceback))
logger = Logger()
logger.notify_channel("web-services", LOG_ERROR,
'Exception in call: \n' + tb_s)
raise Exception("%s -- %s\n\n%s" % (origin, description, details))
+3 -7
View File
@@ -75,13 +75,9 @@ class BrowseRecord(object):
elif hasattr(self._table, name):
return getattr(self._table, name)
else:
logger = Logger()
stack = ''.join(traceback.format_stack())
logger.notify_channel('orm', LOG_ERROR,
"Programming error: field '%s' " \
"does not exist in object '%s'!\n%s" % \
(name, self._table._name, stack))
return False
raise ExceptORM('Error', 'Programming error: field "%s" ' \
'does not exist in object "%s"!' \
% (name, self._table._name))
# if the field is a classic one or a many2one,
# we'll fetch all classic and many2one fields