diff -r e651d5f24cb5 -r b01dd0ef43aa cubicweb/web/views/basecontrollers.py --- a/cubicweb/web/views/basecontrollers.py Wed Mar 13 13:37:49 2019 +0100 +++ b/cubicweb/web/views/basecontrollers.py Thu Mar 14 14:43:18 2019 +0100 @@ -19,60 +19,18 @@ object to handle publication. """ - -from cubicweb import _ - -from warnings import warn - from six import text_type from six.moves import http_client -from logilab.common.deprecation import deprecated - from cubicweb import (NoSelectableObject, ObjectNotFound, ValidationError, AuthenticationError, UndoTransactionException, Forbidden) from cubicweb.utils import json_dumps from cubicweb.predicates import (authenticated_user, anonymous_user, match_form_params) -from cubicweb.web import Redirect, RemoteCallFailed -from cubicweb.web.controller import Controller, append_url_params +from cubicweb.web import Redirect +from cubicweb.web.controller import Controller from cubicweb.web.views import vid_from_rset -import cubicweb.transaction as tx - -@deprecated('[3.15] jsonize is deprecated, use AjaxFunction appobjects instead') -def jsonize(func): - """decorator to sets correct content_type and calls `json_dumps` on - results - """ - def wrapper(self, *args, **kwargs): - self._cw.set_content_type('application/json') - return json_dumps(func(self, *args, **kwargs)) - wrapper.__name__ = func.__name__ - return wrapper - -@deprecated('[3.15] xhtmlize is deprecated, use AjaxFunction appobjects instead') -def xhtmlize(func): - """decorator to sets correct content_type and calls `xmlize` on results""" - def wrapper(self, *args, **kwargs): - self._cw.set_content_type(self._cw.html_content_type()) - result = func(self, *args, **kwargs) - return ''.join((u'
', result.strip(), - u'
')) - wrapper.__name__ = func.__name__ - return wrapper - -@deprecated('[3.15] check_pageid is deprecated, use AjaxFunction appobjects instead') -def check_pageid(func): - """decorator which checks the given pageid is found in the - user's session data - """ - def wrapper(self, *args, **kwargs): - data = self._cw.session.data.get(self._cw.pageid) - if data is None: - raise RemoteCallFailed(self._cw._('pageid-not-found')) - return func(self, *args, **kwargs) - return wrapper class LoginController(Controller): @@ -255,16 +213,6 @@ return self.response(domid, status, args, entity).encode(self._cw.encoding) -class JSonController(Controller): - __regid__ = 'json' - - def publish(self, rset=None): - warn('[3.15] JSONController is deprecated, use AjaxController instead', - DeprecationWarning) - ajax_controller = self._cw.vreg['controllers'].select('ajax', self._cw, appli=self.appli) - return ajax_controller.publish(rset) - - class MailBugReportController(Controller): __regid__ = 'reportbug' __select__ = match_form_params('description')