summaryrefslogtreecommitdiff
path: root/openerp/exceptions.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2014-07-06 16:44:26 +0200
committerAntony Lesuisse <al@openerp.com>2014-07-06 17:05:41 +0200
commitcbe2dbb672a6c55d86f2e515f9d1cdfee426ef80 (patch)
treed6ff62b719fce32392397783c961b734b1e4c50e /openerp/exceptions.py
parentd78192c489d3be66cd6487b39f5ce7ba4733a187 (diff)
[MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from bzr to git was not correctly done. The git history contains irrelevant blobs and commits. This branch brings a lot of changes and fixes, too many to list exhaustively. - New orm api, objects are now used instead of ids - Environements to encapsulates cr uid context while maintaining backward compatibility - Field compute attribute is a new object oriented way to define function fields - Shared browse record cache - New onchange protocol - Optional copy flag on fields - Documentation update - Dead code cleanup - Lots of fixes
Diffstat (limited to 'openerp/exceptions.py')
-rw-r--r--openerp/exceptions.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/openerp/exceptions.py b/openerp/exceptions.py
index 7789345585c..1d59fa67a7c 100644
--- a/openerp/exceptions.py
+++ b/openerp/exceptions.py
@@ -28,6 +28,13 @@ treated as a 'Server error'.
If you consider introducing new exceptions, check out the test_exceptions addon.
"""
+# kept for backward compatibility
+class except_orm(Exception):
+ def __init__(self, name, value):
+ self.name = name
+ self.value = value
+ self.args = (name, value)
+
class Warning(Exception):
pass
@@ -47,8 +54,15 @@ class AccessDenied(Exception):
super(AccessDenied, self).__init__('Access denied.')
self.traceback = ('', '', '')
-class AccessError(Exception):
+class AccessError(except_orm):
""" Access rights error. """
+ def __init__(self, msg):
+ super(AccessError, self).__init__('AccessError', msg)
+
+class MissingError(except_orm):
+ """ Missing record(s). """
+ def __init__(self, msg):
+ super(MissingError, self).__init__('MissingError', msg)
class DeferredException(Exception):
""" Exception object holding a traceback for asynchronous reporting.