Skip to content

Commit 41e5400

Browse files
author
Richard Jones
committed
can now unset values in CSV editing [SF#704788]
1 parent 5cbe480 commit 41e5400

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Fixed:
6969
- fixed export/import of retired nodes (sf bug 685273)
7070
- remember the display template specified during edit (sf bug 701815)
7171
- added example HTML tempating for vacation flag (sf bug 701722)
72+
- only look for CSV files when importing (thanks Dan Grassi)
73+
- can now unset values in CSV editing (sf bug 704788)
7274

7375

7476
2003-??-?? 0.5.7

roundup/cgi/client.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.107 2003-03-18 00:24:35 richard Exp $
1+
# $Id: client.py,v 1.108 2003-03-19 02:50:40 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1213,6 +1213,12 @@ def editCSVAction(self):
12131213
nodeid, values = values[0], values[1:]
12141214
found[nodeid] = 1
12151215

1216+
# see if the node exists
1217+
if cl.hasnode(nodeid):
1218+
exists = 1
1219+
else:
1220+
exists = 0
1221+
12161222
# confirm correct weight
12171223
if len(idlessprops) != len(values):
12181224
self.error_message.append(
@@ -1222,16 +1228,23 @@ def editCSVAction(self):
12221228
# extract the new values
12231229
d = {}
12241230
for name, value in zip(idlessprops, values):
1231+
prop = cl.properties[name]
12251232
value = value.strip()
12261233
# only add the property if it has a value
12271234
if value:
12281235
# if it's a multilink, split it
1229-
if isinstance(cl.properties[name], hyperdb.Multilink):
1236+
if isinstance(prop, hyperdb.Multilink):
12301237
value = value.split(':')
12311238
d[name] = value
1239+
elif exists:
1240+
# nuke the existing value
1241+
if isinstance(prop, hyperdb.Multilink):
1242+
d[name] = []
1243+
else:
1244+
d[name] = None
12321245

12331246
# perform the edit
1234-
if cl.hasnode(nodeid):
1247+
if exists:
12351248
# edit existing
12361249
cl.set(nodeid, **d)
12371250
else:

0 commit comments

Comments
 (0)