Skip to content

Commit 4c83086

Browse files
committed
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.
1 parent 1bad98c commit 4c83086

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

roundup/hyperdb.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
from roundup.i18n import _
3131
from roundup.cgi.exceptions import DetectorError
3232

33+
# import other errors that a detector is allowed to throw
34+
# so they can be raised and not captured by the DetectorError
35+
from roundup.exceptions import Reject, RejectRaw
36+
try:
37+
from pytz import UnknownTimeZoneError
38+
except:
39+
UnknownTimeZoneError = ValueError
40+
3341
#
3442
# Types
3543
#
@@ -1294,6 +1302,10 @@ def fireAuditors(self, event, nodeid, newvalues):
12941302
for prio, name, audit in self.auditors[event]:
12951303
try:
12961304
audit(self.db, self, nodeid, newvalues)
1305+
except (Reject, RejectRaw, ValueError, UnknownTimeZoneError):
1306+
# these are raised by detectors to cause actions
1307+
# to occur at other levels. Reassert them.
1308+
raise
12971309
except Exception as e:
12981310
tb = traceback.format_exc()
12991311
html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>').
@@ -1312,6 +1324,10 @@ def fireReactors(self, event, nodeid, oldvalues):
13121324
for prio, name, react in self.reactors[event]:
13131325
try:
13141326
react(self.db, self, nodeid, oldvalues)
1327+
except (Reject, RejectRaw, ValueError):
1328+
# these are raised by detectors to cause actions
1329+
# to occur at other levels. Reassert them.
1330+
raise
13151331
except Exception as e:
13161332
tb = traceback.format_exc()
13171333
html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>').

0 commit comments

Comments
 (0)