Mercurial > p > roundup > code
diff roundup/hyperdb.py @ 5080:89d69a822e5c
Prior patch for issue2550826 captured too many exceptions
from detectors. Including those exceptions that have to be
passed up unmolested: ValueError, Reject, RejectRaw.
This broke a number of tests in
test/test_userauditor.py
This patch passes these excpetions up the chain bypassing the
DetectorError exception. It alo include pytz's UnknownTimezoneError
which is passed up by an auditor.
This isn't the greatest patch, but it does fix the test suite. There
may be another set of patches in this area depending on the answers I
get from my mail to the roundup-devel mailinglist.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 11 Jun 2016 12:32:56 -0400 |
| parents | 65fef7858606 |
| children | 675b3b3d88f0 |
line wrap: on
line diff
--- a/roundup/hyperdb.py Fri Jun 10 23:33:11 2016 -0400 +++ b/roundup/hyperdb.py Sat Jun 11 12:32:56 2016 -0400 @@ -30,6 +30,14 @@ from roundup.i18n import _ from roundup.cgi.exceptions import DetectorError +# import other errors that a detector is allowed to throw +# so they can be raised and not captured by the DetectorError +from roundup.exceptions import Reject, RejectRaw +try: + from pytz import UnknownTimeZoneError +except: + UnknownTimeZoneError = ValueError + # # Types # @@ -1294,6 +1302,10 @@ for prio, name, audit in self.auditors[event]: try: audit(self.db, self, nodeid, newvalues) + except (Reject, RejectRaw, ValueError, UnknownTimeZoneError): + # these are raised by detectors to cause actions + # to occur at other levels. Reassert them. + raise except Exception as e: tb = traceback.format_exc() html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>'). @@ -1312,6 +1324,10 @@ for prio, name, react in self.reactors[event]: try: react(self.db, self, nodeid, oldvalues) + except (Reject, RejectRaw, ValueError): + # these are raised by detectors to cause actions + # to occur at other levels. Reassert them. + raise except Exception as e: tb = traceback.format_exc() html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>').
