1- # $Id: client.py,v 1.65.2.5 2003-03-15 23:30:07 richard Exp $
1+ # $Id: client.py,v 1.65.2.6 2003-03-19 02:50:12 richard Exp $
22
33__doc__ = """
44WWW request handler (also used in the stand-alone server).
@@ -827,6 +827,9 @@ def newItemPermission(self, props):
827827 return 1
828828 return 0
829829
830+ #
831+ # More actions
832+ #
830833 def editCSVAction (self ):
831834 ''' Performs an edit of all of a class' items in one go.
832835
@@ -872,6 +875,12 @@ def editCSVAction(self):
872875 nodeid , values = values [0 ], values [1 :]
873876 found [nodeid ] = 1
874877
878+ # see if the node exists
879+ if cl .hasnode (nodeid ):
880+ exists = 1
881+ else :
882+ exists = 0
883+
875884 # confirm correct weight
876885 if len (idlessprops ) != len (values ):
877886 self .error_message .append (
@@ -881,16 +890,23 @@ def editCSVAction(self):
881890 # extract the new values
882891 d = {}
883892 for name , value in zip (idlessprops , values ):
893+ prop = cl .properties [name ]
884894 value = value .strip ()
885895 # only add the property if it has a value
886896 if value :
887897 # if it's a multilink, split it
888- if isinstance (cl . properties [ name ] , hyperdb .Multilink ):
898+ if isinstance (prop , hyperdb .Multilink ):
889899 value = value .split (':' )
890900 d [name ] = value
901+ elif exists :
902+ # nuke the existing value
903+ if isinstance (prop , hyperdb .Multilink ):
904+ d [name ] = []
905+ else :
906+ d [name ] = None
891907
892908 # perform the edit
893- if cl . hasnode ( nodeid ) :
909+ if exists :
894910 # edit existing
895911 cl .set (nodeid , ** d )
896912 else :
0 commit comments