Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 1534:f0208e139234
can now unset values in CSV editing [SF#704788]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 19 Mar 2003 02:50:40 +0000 |
| parents | 1bb5e4dd12f3 |
| children | 3fb2872f9b7d |
line wrap: on
line diff
--- a/roundup/cgi/client.py Tue Mar 18 23:28:16 2003 +0000 +++ b/roundup/cgi/client.py Wed Mar 19 02:50:40 2003 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.107 2003-03-18 00:24:35 richard Exp $ +# $Id: client.py,v 1.108 2003-03-19 02:50:40 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -1213,6 +1213,12 @@ nodeid, values = values[0], values[1:] found[nodeid] = 1 + # see if the node exists + if cl.hasnode(nodeid): + exists = 1 + else: + exists = 0 + # confirm correct weight if len(idlessprops) != len(values): self.error_message.append( @@ -1222,16 +1228,23 @@ # extract the new values d = {} for name, value in zip(idlessprops, values): + prop = cl.properties[name] value = value.strip() # only add the property if it has a value if value: # if it's a multilink, split it - if isinstance(cl.properties[name], hyperdb.Multilink): + if isinstance(prop, hyperdb.Multilink): value = value.split(':') d[name] = value + elif exists: + # nuke the existing value + if isinstance(prop, hyperdb.Multilink): + d[name] = [] + else: + d[name] = None # perform the edit - if cl.hasnode(nodeid): + if exists: # edit existing cl.set(nodeid, **d) else:
