Skip to content

Commit

Permalink
fix: cae1bbf2536b - expression errors not setting result properly
Browse files Browse the repository at this point in the history
Rather than setting 'result' in renderContext, I was wrirting the
output directly, but was stil falling through to where result would be
used.

This caused email to be sent to the admin and when test_mailgw was
called the mail-test.log was somehow created and caused the test there
to fail.

Fixed renderContext to use result variable and output contents of
mail-test.log to make debugging easier.

This should fix CI failure.
  • Loading branch information
rouilj committed Jan 5, 2025
1 parent 283608f commit a9c5fd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion roundup/cgi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ def renderContext(self):
except ExpressionError as e:
self.add_error_message(str(e))
self.template = "search"
self.write_html(self.renderContext())
result = self.renderContext()

if 'Content-Type' not in self.additional_headers:
self.additional_headers['Content-Type'] = pt.content_type
Expand Down
3 changes: 3 additions & 0 deletions test/test_mailgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ def testAlternateAddress(self):
This is a test submission of a new issue.
''')
userlist = self.db.user.list()
if os.path.exists(SENDMAILDEBUG):
with open(SENDMAILDEBUG) as f:
print(f.read())
assert not os.path.exists(SENDMAILDEBUG)
self.assertEqual(userlist, self.db.user.list(),
"user created when it shouldn't have been")
Expand Down

0 comments on commit a9c5fd9

Please sign in to comment.