Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 1381:944bd3c6d365
more cgi form parsing tests, and a fix for an outstanding couple of bugs
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 15 Jan 2003 11:07:45 +0000 |
| parents | 4ce6820c18fa |
| children | 87143c3d7156 |
line wrap: on
line diff
--- a/roundup/cgi/client.py Tue Jan 14 22:21:35 2003 +0000 +++ b/roundup/cgi/client.py Wed Jan 15 11:07:45 2003 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.68 2003-01-14 22:21:35 richard Exp $ +# $Id: client.py,v 1.69 2003-01-15 11:07:45 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -1242,6 +1242,9 @@ # it's a MiniFieldStorage, but may be a comma-separated list # of values value = [i.strip() for i in value.value.split(',')] + + # filter out the empty bits + value = filter(None, value) else: # multiple values are not OK if isinstance(value, type([])): @@ -1302,12 +1305,13 @@ elif isinstance(proptype, hyperdb.Multilink): # perform link class key value lookup if necessary link = proptype.classname + link_cl = db.classes[link] l = [] for entry in value: if not entry: continue if not num_re.match(entry): try: - entry = db.classes[link].lookup(entry) + entry = link_cl.lookup(entry) except KeyError: raise ValueError, _('property "%(propname)s": ' '"%(value)s" not an entry of %(classname)s')%{ @@ -1371,6 +1375,10 @@ if not existing and not value: continue + # existing will come out unsorted in some cases + if isinstance(proptype, hyperdb.Multilink): + existing.sort() + # if changed, set it if value != existing: props[propname] = value
