Mercurial > p > roundup > code
diff roundup/cgi/cgitb.py @ 7808:6c5f8da9fca7
fix: cgitb crashes if there is no line number set.
I am not sure why:
context.position[0]
is None when an exception happens while processing templates. This
causes a second exception because of a print statement matching %d to
None. The second exception blows away any chance at getting useful
info. So fix it by passing line number -1. Hopefully people will
recognize that as bogus and interpret it as no line number was
available.
Fixing the underlying cause (in ZopeTAL???) would be better though.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 13 Mar 2024 18:25:59 -0400 |
| parents | 57f34b0b912c |
| children | 6763813d9d34 |
line wrap: on
line diff
--- a/roundup/cgi/cgitb.py Wed Mar 13 18:16:51 2024 -0400 +++ b/roundup/cgi/cgitb.py Wed Mar 13 18:25:59 2024 -0400 @@ -104,7 +104,7 @@ </table></li> ''') % { 'info': info, - 'line': context.position[0], + 'line': context.position[0] or -1, 'globals': niceDict(' ', context.global_vars), 'locals': niceDict(' ', context.local_vars) })
