Skip to content

Commit 1dec275

Browse files
author
Richard Jones
committed
allow multiple :remove and :add elements per property being edited
1 parent 8bc0545 commit 1dec275

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ are given with the most recent entry first.
2121
- allow StringHTMLProperty in MultilinkHTMLProperty test to work
2222
- don't set explicit None Link properties in web create
2323
- fixed nasty sorting bug that was lowercasing properties
24+
- allow multiple :remove and :add elements per property being edited
2425

2526

2627
2002-11-07 0.5.2

doc/customizing.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.64 $
5+
:Version: $Revision: 1.65 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -731,6 +731,12 @@ triggered by using a ``:action`` CGI variable, where the value is one of:
731731
the :note if it's supplied.
732732
:required=property,property,...
733733
The named properties are required to be filled in the form.
734+
:remove:<propname>=id(s)
735+
The ids will be removed from the multilink property. You may have multiple
736+
:remove:<propname> form elements for a single <propname>.
737+
:add:<propname>=id(s)
738+
The ids will be added to the multilink property. You may have multiple
739+
:add:<propname> form elements for a single <propname>.
734740

735741
**new**
736742
Add a new item to the database. You may use the same special form elements

roundup/cgi/client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.61 2002-12-10 23:39:40 richard Exp $
1+
# $Id: client.py,v 1.62 2002-12-11 01:46:46 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1173,6 +1173,7 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')):
11731173
props = {}
11741174
keys = form.keys()
11751175
properties = cl.getprops()
1176+
existing_cache = {}
11761177
for key in keys:
11771178
# see if we're performing a special multilink action
11781179
mlaction = 'set'
@@ -1289,10 +1290,12 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')):
12891290
value = l
12901291
else:
12911292
# we're modifying the list - get the current list of ids
1292-
try:
1293-
existing = cl.get(nodeid, propname)
1294-
except KeyError:
1295-
existing = []
1293+
if props.has_key(propname):
1294+
existing = props[propname]
1295+
else:
1296+
existing = cl.get(nodeid, propname, [])
1297+
1298+
# now either remove or add
12961299
if mlaction == 'remove':
12971300
# remove - handle situation where the id isn't in the list
12981301
for entry in l:

0 commit comments

Comments
 (0)