diff roundup/rest.py @ 5926:3ca3bfe6de16

Code-robustness, error-message improved .. for REST-API PATCH method with @op = action
author Ralf Schlatterbeck <rsc@runtux.com>
date Tue, 15 Oct 2019 16:23:06 +0200
parents 2b78e21d7047
children 5d0873a4de4a
line wrap: on
line diff
--- a/roundup/rest.py	Sun Oct 13 18:09:19 2019 -0400
+++ b/roundup/rest.py	Tue Oct 15 16:23:06 2019 +0200
@@ -1415,6 +1415,7 @@
         action_args = [class_name + item_id]
         if op == 'action':
             # extract action_name and action_args from form fields
+            name = None
             for form_field in input.value:
                 key = form_field.name
                 value = form_field.value
@@ -1427,8 +1428,8 @@
                 action_type = self.actions[name]
             else:
                 raise UsageError(
-                    'action "%s" is not supported %s' %
-                    (name, ','.join(self.actions.keys()))
+                    'action "%s" is not supported, allowed: %s' %
+                    (name, ', '.join(self.actions.keys()))
                 )
             action = action_type(self.db, self.translator)
             result = action.execute(*action_args)

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