[gen] Minor improvements.

This commit is contained in:
Gaetan Delannay 2014-08-05 14:53:08 +02:00
parent 636def8d24
commit 9cccdebe24
4 changed files with 21 additions and 8 deletions

View file

@ -1422,4 +1422,16 @@ class ToolMixin(BaseMixin):
if version < self.ieMin:
mapping = {'version': version, 'min': self.ieMin}
return self.translate('wrong_browser', mapping=mapping)
def executeAjaxAction(self, action, obj, field):
'''When PX "pxAjax" is called to get some chunk of XHTML via an Ajax
request, a server action can be executed before rendering the XHTML
chunk. This method executes this action.'''
if action.startswith(':'):
# The action corresponds to a method on Appy p_obj.
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)()
# ------------------------------------------------------------------------------