From 7a031eba12231ed54db48e24261acc97e8ea7b48 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 15 Jan 2003 11:14:01 +0000 Subject: [PATCH] really fix bug 663235, and test it git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1458 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi/client.py | 7 ++++--- test/test_cgi.py | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index 4affd22..a56ea56 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.69 2003-01-15 11:07:45 richard Exp $ +# $Id: client.py,v 1.70 2003-01-15 11:14:01 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -1207,7 +1207,6 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')): props = {} keys = form.keys() properties = cl.getprops() - existing_cache = {} for key in keys: # see if we're performing a special multilink action mlaction = 'set' @@ -1331,8 +1330,10 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')): # we're modifying the list - get the current list of ids if props.has_key(propname): existing = props[propname] - else: + elif nodeid: existing = cl.get(nodeid, propname, []) + else: + existing = [] # now either remove or add if mlaction == 'remove': diff --git a/test/test_cgi.py b/test/test_cgi.py index 781dbc6..f562245 100644 --- a/test/test_cgi.py +++ b/test/test_cgi.py @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_cgi.py,v 1.3 2003-01-15 11:07:45 richard Exp $ +# $Id: test_cgi.py,v 1.4 2003-01-15 11:14:01 richard Exp $ import unittest, os, shutil, errno, sys, difflib, cgi @@ -140,6 +140,10 @@ class FormTestCase(unittest.TestCase): self.assertEqual(client.parsePropsFromForm(self.db, self.db.issue, makeForm({':add:nosy': ['2','3']}), nodeid), {'nosy': ['1','2','3']}) + def testMultilinkAddNew(self): + self.assertEqual(client.parsePropsFromForm(self.db, self.db.issue, + makeForm({':add:nosy': ['2','3']})), {'nosy': ['2','3']}) + def testMultilinkRemove(self): nodeid = self.db.issue.create(nosy=['1','2']) # do nothing -- 2.39.5