Roundup Tracker - Issues

Issue 2550504

classification
Robustify templating.py
Type: crash Severity: normal
Components: Web interface Versions: devel
process
Status: closed fixed
:
: stefan : richard, stefan
Priority: : patch, patch

Created on 2009-02-16 20:18 by stefan, last changed 2009-02-16 21:03 by stefan.

Files
File name Uploaded Description Edit Remove
templating.patch stefan, 2009-02-16 20:18
Messages
msg3546 Author: [hidden] (stefan) Date: 2009-02-16 20:18
When submitting form requests containing multiple values where only a
single value is expected, an (internal) AttributeError is raised, e.g.:

File "roundup/cgi/templating.py", line 538, in __getitem__
    value = form[item].value.strip()
AttributeError: 'list' object has no attribute 'value'

A way to deal with this problem is to rewrite

form[item].value

as

form.getfirst(item)

(This also solves http://psf.upfronthosting.co.za/roundup/meta/issue111
in a cleaner way than has been done before.)

Please find attached a patch, containing a) a new test generating the
exception, and b) a couple of fixes like the above, making the failure
from a) disappear.

OK to check in ?
msg3547 Author: [hidden] (richard) Date: 2009-02-16 20:54
The change does mean there's potential to hide errors in the tracker
template, but I guess it's better to not crash, so sure, apply the patch.
msg3548 Author: [hidden] (stefan) Date: 2009-02-16 21:01
Richard Jones wrote:
> Richard Jones <richard@mechanicalcat.net> added the comment:
> 
> The change does mean there's potential to hide errors in the tracker
> template, but I guess it's better to not crash, so sure, apply the patch.

Indeed, it may hide errors in a template. Or someone mistyped an URL, 
or... So I believe making Roundup ignore such errors is better than to 
raise an exception. (One could think of adding support for logging 
incorrect queries...)

Thanks,
		Stefan
History
Date User Action Args
2009-02-16 21:03:08stefansetstatus: new -> closed
keywords: patch, patch
resolution: fixed
2009-02-16 21:01:13stefansetmessages: + msg3548
2009-02-16 20:54:30richardsetkeywords: patch, patch
messages: + msg3547
2009-02-16 20:18:07stefancreate