Code

can now unset values in CSV editing (sf bug 704788)
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 19 Mar 2003 02:50:40 +0000 (02:50 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 19 Mar 2003 02:50:40 +0000 (02:50 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1606 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
roundup/cgi/client.py

index 9c53e0208333a6b7e2efd7583a7318466b631955..f8baa3ad9c0ccde8c9b053f0e5b9e1c6ba7e145e 100644 (file)
@@ -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
index aa6d0868116afcf98f91e4ff69b6c3e6c2ca297f..a96babfd7e6ccb7af54ad7c4fa2a69d5b1ae18f5 100644 (file)
@@ -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: