comparison roundup/xmlrpc.py @ 5604:ed02a1e0aa5d REST-rebased

Fix actions Permission for retire in roundup/actions.py was with 'Edit' permission, not 'Retire' permission. Add a 'restore' action to roundup/actions.py. Both are now correctly used in rest.py and xmlrpc.py (the latter had some errors when printint error messages). Also reworked the rest implementation: Despite the warnings in the roundup API in hyperdb.py the DELETE http method would *destroy* and not *retire* an item. This has been fixed. We also do not allow retire of a complete class (although this was implemented) because this seems to dangerous and we see no use-case.
author Ralf Schlatterbeck <rsc@runtux.com>
date Wed, 30 Jan 2019 14:12:27 +0100
parents 7f3dfdd6a620
children af1067e0f6d9
comparison
equal deleted inserted replaced
5603:79da1ca2f94b 5604:ed02a1e0aa5d
177 logger.debug(l) 177 logger.debug(l)
178 raise UsageError (message) 178 raise UsageError (message)
179 return result 179 return result
180 180
181 181
182 builtin_actions = {'retire': actions.Retire} 182 builtin_actions = dict (retire = actions.Retire, restore = actions.Restore)
183 183
184 def action(self, name, *args): 184 def action(self, name, *args):
185 """Execute a named action.""" 185 """Execute a named action."""
186 186
187 if name in self.actions: 187 if name in self.actions:
188 action_type = self.actions[name] 188 action_type = self.actions[name]
189 elif name in self.builtin_actions: 189 elif name in self.builtin_actions:
190 action_type = self.builtin_actions[name] 190 action_type = self.builtin_actions[name]
191 else: 191 else:
192 raise Exception('action "%s" is not supported %s' % (name, ','.join(self.actions.keys()))) 192 raise Exception('action "%s" is not supported %s'
193 % (name, ','.join(self.actions.keys())))
193 action = action_type(self.db, self.translator) 194 action = action_type(self.db, self.translator)
194 return action.execute(*args) 195 return action.execute(*args)
195 196
196 197
197 class RoundupDispatcher(SimpleXMLRPCDispatcher): 198 class RoundupDispatcher(SimpleXMLRPCDispatcher):

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