12 |
12 |
13 from decimal import Decimal |
13 from decimal import Decimal |
14 from datetime import datetime, date, timedelta |
14 from datetime import datetime, date, timedelta |
15 from simplejson import dumps |
15 from simplejson import dumps |
16 |
16 |
17 from logilab.common.deprecation import obsolete |
17 from logilab.common.deprecation import deprecated |
18 |
18 |
19 from cubicweb.common.uilib import urlquote |
19 from cubicweb.common.uilib import urlquote |
20 from cubicweb.web._exceptions import * |
20 from cubicweb.web._exceptions import * |
21 |
21 |
22 |
22 |
63 def jsonize(function): |
63 def jsonize(function): |
64 def newfunc(*args, **kwargs): |
64 def newfunc(*args, **kwargs): |
65 return json_dumps(function(*args, **kwargs)) |
65 return json_dumps(function(*args, **kwargs)) |
66 return newfunc |
66 return newfunc |
67 |
67 |
68 @obsolete('use req.build_ajax_replace_url() instead') |
68 @deprecated('use req.build_ajax_replace_url() instead') |
69 def ajax_replace_url(nodeid, rql, vid=None, swap=False, **extraparams): |
69 def ajax_replace_url(nodeid, rql, vid=None, swap=False, **extraparams): |
70 """builds a replacePageChunk-like url |
70 """builds a replacePageChunk-like url |
71 >>> ajax_replace_url('foo', 'Person P') |
71 >>> ajax_replace_url('foo', 'Person P') |
72 "javascript: replacePageChunk('foo', 'Person%20P');" |
72 "javascript: replacePageChunk('foo', 'Person%20P');" |
73 >>> ajax_replace_url('foo', 'Person P', 'oneline') |
73 >>> ajax_replace_url('foo', 'Person P', 'oneline') |