[gen] Allow an ajax request to return a message, carried as a custom HTTP header and retrieved by appy.js to display a message.

This commit is contained in:
Gaetan Delannay 2014-11-10 13:34:52 +01:00
parent 8d03f6ca9c
commit 4a393e76af
5 changed files with 33 additions and 15 deletions

View file

@ -1284,9 +1284,10 @@ class ToolMixin(BaseMixin):
chunk. This method executes this action.'''
if action.startswith(':'):
# The action corresponds to a method on Appy p_obj.
getattr(obj, action[1:])()
msg = getattr(obj, action[1:])()
else:
# The action must be executed on p_field if present, on obj.o else.
if field: getattr(field, action)(obj.o)
else: getattr(obj.o, action)()
if field: msg = getattr(field, action)(obj.o)
else: msg = getattr(obj.o, action)()
return msg
# ------------------------------------------------------------------------------