From: richard Date: Wed, 19 Mar 2003 02:50:40 +0000 (+0000) Subject: can now unset values in CSV editing (sf bug 704788) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ce4450b8ae5261a140a0d2fbd22fd41c57e383f1;p=roundup.git can now unset values in CSV editing (sf bug 704788) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1606 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 9c53e02..f8baa3a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -69,6 +69,8 @@ Fixed: - fixed export/import of retired nodes (sf bug 685273) - remember the display template specified during edit (sf bug 701815) - added example HTML tempating for vacation flag (sf bug 701722) +- only look for CSV files when importing (thanks Dan Grassi) +- can now unset values in CSV editing (sf bug 704788) 2003-??-?? 0.5.7 diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index aa6d086..a96babf 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -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 @@ You should then receive another email with the new password. 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 @@ You should then receive another email with the new password. # 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: