Skip to content

Commit 378763f

Browse files
committed
Code-robustness, error-message improved
.. for REST-API PATCH method with @op = action
1 parent 9dea853 commit 378763f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

roundup/rest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@ def patch_element(self, class_name, item_id, input):
14151415
action_args = [class_name + item_id]
14161416
if op == 'action':
14171417
# extract action_name and action_args from form fields
1418+
name = None
14181419
for form_field in input.value:
14191420
key = form_field.name
14201421
value = form_field.value
@@ -1427,8 +1428,8 @@ def patch_element(self, class_name, item_id, input):
14271428
action_type = self.actions[name]
14281429
else:
14291430
raise UsageError(
1430-
'action "%s" is not supported %s' %
1431-
(name, ','.join(self.actions.keys()))
1431+
'action "%s" is not supported, allowed: %s' %
1432+
(name, ', '.join(self.actions.keys()))
14321433
)
14331434
action = action_type(self.db, self.translator)
14341435
result = action.execute(*action_args)

0 commit comments

Comments
 (0)