34 from cubicweb.web import Redirect, RemoteCallFailed |
34 from cubicweb.web import Redirect, RemoteCallFailed |
35 from cubicweb.web.controller import Controller |
35 from cubicweb.web.controller import Controller |
36 from cubicweb.web.views import vid_from_rset |
36 from cubicweb.web.views import vid_from_rset |
37 |
37 |
38 |
38 |
39 @deprecated('jsonize is deprecated, use AjaxFunction appobjects instead') |
39 @deprecated('[3.15] jsonize is deprecated, use AjaxFunction appobjects instead') |
40 def jsonize(func): |
40 def jsonize(func): |
41 """decorator to sets correct content_type and calls `json_dumps` on |
41 """decorator to sets correct content_type and calls `json_dumps` on |
42 results |
42 results |
43 """ |
43 """ |
44 def wrapper(self, *args, **kwargs): |
44 def wrapper(self, *args, **kwargs): |
45 self._cw.set_content_type('application/json') |
45 self._cw.set_content_type('application/json') |
46 return json_dumps(func(self, *args, **kwargs)) |
46 return json_dumps(func(self, *args, **kwargs)) |
47 wrapper.__name__ = func.__name__ |
47 wrapper.__name__ = func.__name__ |
48 return wrapper |
48 return wrapper |
49 |
49 |
50 @deprecated('xhtmlize is deprecated, use AjaxFunction appobjects instead') |
50 @deprecated('[3.15] xhtmlize is deprecated, use AjaxFunction appobjects instead') |
51 def xhtmlize(func): |
51 def xhtmlize(func): |
52 """decorator to sets correct content_type and calls `xmlize` on results""" |
52 """decorator to sets correct content_type and calls `xmlize` on results""" |
53 def wrapper(self, *args, **kwargs): |
53 def wrapper(self, *args, **kwargs): |
54 self._cw.set_content_type(self._cw.html_content_type()) |
54 self._cw.set_content_type(self._cw.html_content_type()) |
55 result = func(self, *args, **kwargs) |
55 result = func(self, *args, **kwargs) |
56 return ''.join((self._cw.document_surrounding_div(), result.strip(), |
56 return ''.join((self._cw.document_surrounding_div(), result.strip(), |
57 u'</div>')) |
57 u'</div>')) |
58 wrapper.__name__ = func.__name__ |
58 wrapper.__name__ = func.__name__ |
59 return wrapper |
59 return wrapper |
60 |
60 |
61 @deprecated('check_pageid is deprecated, use AjaxFunction appobjects instead') |
61 @deprecated('[3.15] check_pageid is deprecated, use AjaxFunction appobjects instead') |
62 def check_pageid(func): |
62 def check_pageid(func): |
63 """decorator which checks the given pageid is found in the |
63 """decorator which checks the given pageid is found in the |
64 user's session data |
64 user's session data |
65 """ |
65 """ |
66 def wrapper(self, *args, **kwargs): |
66 def wrapper(self, *args, **kwargs): |