changeset 5104:ca3e56590fcd

Fixed issue2550572: setting nosy=+foo on multiple issues gives them all the same exact nosy list. Added a missing reinitialization that has to occur every time though the loop in do_set. Manually tested with: python roundup/scripts/roundup_admin.py -i demo set issue184,issue17 nosy=demo python roundup/scripts/roundup_admin.py -i demo set issue17 nosy=+alpha,+anonymous python roundup/scripts/roundup_admin.py -i demo set issue184 nosy=+beta,+anonymous python roundup/scripts/roundup_admin.py -i demo set issue184,issue17 nosy=-demo,-anonymous,+admin issue17 nosy was admin,alpha issue 184 nosy was admin,beta after tests.
author John Rouillard <rouilj@ieee.org>
date Sun, 26 Jun 2016 22:10:40 -0400
parents c52714a69432
children 37d1e24fb941
files CHANGES.txt roundup/admin.py
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sun Jun 26 20:56:30 2016 -0400
+++ b/CHANGES.txt	Sun Jun 26 22:10:40 2016 -0400
@@ -165,6 +165,10 @@
   Fix old entry in FAQ, update roundup-server config docs and
   example file from current roundup-server output. Update
   some typos in .py files. John Rouillard.
+- issue2550572: setting nosy=+foo on multiple issues gives them all
+  the same exact nosy list. Fixed a missing reinitialization that has
+  to occur every time though the loop in do_set. Manual tests work.
+  (John Rouillard)
   
 2016-01-11: 1.5.1
 
--- a/roundup/admin.py	Sun Jun 26 20:56:30 2016 -0400
+++ b/roundup/admin.py	Sun Jun 26 22:10:40 2016 -0400
@@ -608,6 +608,8 @@
         is un-set. If the property is a multilink, you specify the linked
         ids for the multilink as comma-separated numbers (ie "1,2,3").
         """
+        import copy # needed for copying props list
+
         if len(args) < 2:
             raise UsageError(_('Not enough arguments supplied'))
         from roundup import hyperdb
@@ -628,15 +630,21 @@
                 raise UsageError(message)
 
         # get the props from the args
-        props = self.props_from_args(args[1:])
+        propset = self.props_from_args(args[1:]) # parse the cli once
 
         # now do the set for all the nodes
         for classname, itemid in designators:
+            props = copy.copy(propset) # make a new copy for every designator
             cl = self.get_class(classname)
 
-            properties = cl.getprops()
             for key, value in props.items():
                 try:
+                    # You must reinitialize the props every time though.
+                    # if props['nosy'] = '+admin' initally, it gets
+                    # set to 'demo,admin' (assuming it was set to demo
+                    # in the db) after rawToHyperdb returns.
+                    # This  new value is used for all the rest of the
+                    # designators if not reinitalized.
                     props[key] = hyperdb.rawToHyperdb(self.db, cl, itemid,
                         key, value)
                 except hyperdb.HyperdbValueError, message:

Roundup Issue Tracker: http://roundup-tracker.org/