Code

really fix bug 663235, and test it
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 15 Jan 2003 11:14:01 +0000 (11:14 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 15 Jan 2003 11:14:01 +0000 (11:14 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1458 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/client.py
test/test_cgi.py

index 4affd222278ab89f364949d840cea79b3af270a6..a56ea56a621ce8e45e70e2a5bf2326e0e452dafe 100644 (file)
@@ -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':
index 781dbc69e7f1815f7d2b279568f859c3c9749c45..f56224592927ef29d49def0868fd9ca98d08082a 100644 (file)
@@ -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