1 from turbogears.widgets.base import Widget, JSLink, static, mochikit
2 from turbojson import jsonify
3
4 __all__ = ["RPC"]
5
7 """RPC base widget."""
8
9 params = ["action", "update", "data", "on_success", "on_failure", "on_complete",
10 "before", "after", "loading", "loaded", "confirm"]
11
12 javascript = [mochikit, JSLink(static,'ajax.js')]
13
15 super(RPC, self).update_params(d)
16
17 d['js'] = "return ! remoteRequest(self, '%s', '%s', %s, %s)" % (
18 d.get('action'),
19 d.get('update'),
20 jsonify.encode(d.get('data')),
21 jsonify.encode(self.get_options(d)),
22 )
23
35