Skip to content

Commit e58be10

Browse files
author
Richard Jones
committed
fix :required ordering problem [SF#740214]
1 parent 5ebb295 commit e58be10

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ are given with the most recent entry first.
77
- handle missing Subject: line (sf bug 755331)
88
- handle New User creation (sf bug 754510)
99
- fix hackish message escaping (sf bug 757128)
10+
- fix :required ordering problem (sf bug 740214)
1011

1112

1213
2003-06-10 0.6.0b3

roundup/cgi/client.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.120 2003-06-24 03:30:30 richard Exp $
1+
# $Id: client.py,v 1.121 2003-06-24 03:51:15 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1506,16 +1506,8 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
15061506
The form value is a comma-separated list of
15071507
designators. The item corresponding to each
15081508
designator is linked to the property given by simple
1509-
form variable.
1510-
1511-
XXX Used to add a link to new items created during edit.
1512-
XXX These are collected up and returned in all_links. This will
1513-
XXX result in an additional linking operation (either Link set or
1514-
XXX Multilink append) after the edit/create is done using
1515-
XXX all_props in _editnodes. The <propname> on the current item
1516-
XXX will be set/appended the id of the newly created item of
1517-
XXX class <designator> (where <designator> must be
1518-
XXX <classname>-<N>).
1509+
form variable. These are collected up and returned in
1510+
all_links.
15191511
15201512
None of the above (ie. just a simple form value)
15211513
The value of the form variable is converted
@@ -1605,8 +1597,8 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
16051597
default_nodeid = self.nodeid
16061598

16071599
# we'll store info about the individual class/item edit in these
1608-
all_required = {} # one entry per class/item
1609-
all_props = {} # one entry per class/item
1600+
all_required = {} # required props per class/item
1601+
all_props = {} # props present per class/item
16101602
all_propdef = {} # note - only one entry per class
16111603
all_links = [] # as many as are required
16121604

@@ -1695,11 +1687,6 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
16951687
all_required[this] = extractFormList(form[key])
16961688
continue
16971689

1698-
# get the required values list
1699-
if not all_required.has_key(this):
1700-
all_required[this] = []
1701-
required = all_required[this]
1702-
17031690
# see if we're performing a special multilink action
17041691
mlaction = 'set'
17051692
if d['remove']:
@@ -1919,17 +1906,20 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
19191906

19201907
props[propname] = value
19211908

1922-
# register this as received if required?
1923-
if propname in required and value is not None:
1924-
required.remove(propname)
1925-
19261909
# check to see if we need to specially link a file to the note
19271910
if have_note and have_file:
19281911
all_links.append(('msg', '-1', 'files', [('file', '-1')]))
19291912

19301913
# see if all the required properties have been supplied
19311914
s = []
19321915
for thing, required in all_required.items():
1916+
# register the values we got
1917+
got = all_props.get(thing, {})
1918+
for entry in required:
1919+
if got.get(entry, ''):
1920+
required.remove(entry)
1921+
1922+
# any required values not present?
19331923
if not required:
19341924
continue
19351925
if len(required) > 1:

0 commit comments

Comments
 (0)