[gen] Updated the Ajax system to be able to call a method on a Appy wrapper instead of a Zope object.

This commit is contained in:
Gaetan Delannay 2014-08-05 09:48:05 +02:00
parent fdb8b92fcb
commit 636def8d24
3 changed files with 15 additions and 13 deletions

View file

@ -632,6 +632,7 @@ class AbstractWrapper(object):
dummy=setattr(req, 'pxContext', _ctx_);
lang=ztool.getUserLanguage(); q=ztool.quote;
action=req.get('action', None);
actionObj=(action and action.startswith(':')) and obj or zobj;
px=req['px'].split(':');
inPopup=req.get('popup') == '1';
className=(len(px) == 3) and px[0] or None;
@ -646,8 +647,8 @@ class AbstractWrapper(object):
x=resp.setHeader('CacheControl', 'no-cache')">
<!-- If an action is defined, execute it on p_zobj or on p_field. -->
<x if="action and not field" var2="x=getattr(zobj, action)()"></x>
<x if="action and field" var2="x=getattr(field, action)(zobj)"></x>
<x if="action and not field" var2="x=getattr(actionObj, action)()"></x>
<x if="action and field" var2="x=getattr(field, action)(actionObj)"></x>
<!-- Then, call the PX on p_obj or on p_field. -->
<x if="not field">:getattr(obj, px[0])</x>