Mercurial > p > roundup > code
comparison roundup/admin.py @ 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 | 5251e97b1de0 |
| children | 87b0358790ed |
comparison
equal
deleted
inserted
replaced
| 5103:c52714a69432 | 5104:ca3e56590fcd |
|---|---|
| 606 This command sets the properties to the values for all designators | 606 This command sets the properties to the values for all designators |
| 607 given. If the value is missing (ie. "property=") then the property | 607 given. If the value is missing (ie. "property=") then the property |
| 608 is un-set. If the property is a multilink, you specify the linked | 608 is un-set. If the property is a multilink, you specify the linked |
| 609 ids for the multilink as comma-separated numbers (ie "1,2,3"). | 609 ids for the multilink as comma-separated numbers (ie "1,2,3"). |
| 610 """ | 610 """ |
| 611 import copy # needed for copying props list | |
| 612 | |
| 611 if len(args) < 2: | 613 if len(args) < 2: |
| 612 raise UsageError(_('Not enough arguments supplied')) | 614 raise UsageError(_('Not enough arguments supplied')) |
| 613 from roundup import hyperdb | 615 from roundup import hyperdb |
| 614 | 616 |
| 615 designators = args[0].split(',') | 617 designators = args[0].split(',') |
| 626 designators = [hyperdb.splitDesignator(x) for x in designators] | 628 designators = [hyperdb.splitDesignator(x) for x in designators] |
| 627 except hyperdb.DesignatorError, message: | 629 except hyperdb.DesignatorError, message: |
| 628 raise UsageError(message) | 630 raise UsageError(message) |
| 629 | 631 |
| 630 # get the props from the args | 632 # get the props from the args |
| 631 props = self.props_from_args(args[1:]) | 633 propset = self.props_from_args(args[1:]) # parse the cli once |
| 632 | 634 |
| 633 # now do the set for all the nodes | 635 # now do the set for all the nodes |
| 634 for classname, itemid in designators: | 636 for classname, itemid in designators: |
| 637 props = copy.copy(propset) # make a new copy for every designator | |
| 635 cl = self.get_class(classname) | 638 cl = self.get_class(classname) |
| 636 | 639 |
| 637 properties = cl.getprops() | |
| 638 for key, value in props.items(): | 640 for key, value in props.items(): |
| 639 try: | 641 try: |
| 642 # You must reinitialize the props every time though. | |
| 643 # if props['nosy'] = '+admin' initally, it gets | |
| 644 # set to 'demo,admin' (assuming it was set to demo | |
| 645 # in the db) after rawToHyperdb returns. | |
| 646 # This new value is used for all the rest of the | |
| 647 # designators if not reinitalized. | |
| 640 props[key] = hyperdb.rawToHyperdb(self.db, cl, itemid, | 648 props[key] = hyperdb.rawToHyperdb(self.db, cl, itemid, |
| 641 key, value) | 649 key, value) |
| 642 except hyperdb.HyperdbValueError, message: | 650 except hyperdb.HyperdbValueError, message: |
| 643 raise UsageError(message) | 651 raise UsageError(message) |
| 644 | 652 |
