Roundup Tracker - Issues

Issue 663235

classification
creating new issues may fail due to bug in client.py
Type: Severity: normal
Components: Web interface Versions:
process
Status: closed fixed
:
: richard : richard, stefan
Priority: normal :

Created on 2003-01-06 17:46 by stefan, last changed 2003-01-15 11:16 by richard.

Messages
msg560 Author: [hidden] (stefan) Date: 2003-01-06 17:46
trying to create a new issue ('task') via cgi generates
this traceback:

Traceback (most recent call last):
  File
"/org/fresco.org/lib/python2.1/site-packages/roundup/cgi/client.py",
line 412, in handle_action
    getattr(self, method)()
  File
"/org/fresco.org/lib/python2.1/site-packages/roundup/cgi/client.py",
line 752, in newItemAction
    props = parsePropsFromForm(self.db, cl, self.form,
self.nodeid)
  File
"/org/fresco.org/lib/python2.1/site-packages/roundup/cgi/client.py",
line 1298, in parsePropsFromForm
    existing = cl.get(nodeid, propname, [])
  File
"/org/fresco.org/lib/python2.1/site-packages/roundup/backends/back_anydbm.py",
line 996, in get
    d = self.db.getnode(self.classname, nodeid,
cache=cache)
  File
"/org/fresco.org/lib/python2.1/site-packages/roundup/backends/back_anydbm.py",
line 305, in getnode
    if not db.has_key(nodeid):
TypeError: key type must be string

Looking at the actual code I come to the following
conclusion:

you call parsePropsFromForm with a 'None' nodeid (as
this is called
from 'newItemAction'), but at line 1298 you call
cl.get(nodeid,propname,[]), instead of checking first
whether or not the nodeid is valid.

msg561 Author: [hidden] (stefan) Date: 2003-01-06 20:42
Logged In: YES 
user_id=764

clients.py contains some more highly suspect code around
line 1194:

            if mlaction != 'set':
                raise ValueError, 'You have submitted a
remove action for'\
                    ' the property "%s" which doesn\'t
exist'%propname

this seems to imply that mlaction is either 'set' or
'remove', while
it can be 'add', too ! I may have a form to submit a new
issue where
I allow multiple selections for a multichoice using
checkboxes, using
the ':add:...' technique you introduced recently. This would
fail with the
given code...
msg562 Author: [hidden] (stefan) Date: 2003-01-14 04:23
Logged In: YES 
user_id=764

sorry, but this bug isn't fixed. roundup/cgi/client.py
(version 1.67) line 1330 ff. still contains an 
unconditional call to

cl.get(nodeid, propname, [])

even though nodeid doesn't exist yet (it's called
from inside the 'newItemAction')

msg563 Author: [hidden] (richard) Date: 2003-01-14 04:26
Logged In: YES 
user_id=6405

Someone please help me and write some unit tests for this! (really!!) 
 
OK, I'll look into it. 
 
msg564 Author: [hidden] (richard) Date: 2003-01-15 11:16
Logged In: YES 
user_id=6405

OK, I've really fixed this now, and there's a unit test and all. 
 
(I haven't committed the changes to the maint branch yet tho - would you 
like me to let you know when I do?) 
 
History
Date User Action Args
2003-01-06 17:46:07stefancreate