20 from cubicweb import (NoSelectableObject, ValidationError, ObjectNotFound, |
20 from cubicweb import (NoSelectableObject, ValidationError, ObjectNotFound, |
21 typed_eid) |
21 typed_eid) |
22 from cubicweb.utils import CubicWebJsonEncoder |
22 from cubicweb.utils import CubicWebJsonEncoder |
23 from cubicweb.selectors import authenticated_user, match_form_params |
23 from cubicweb.selectors import authenticated_user, match_form_params |
24 from cubicweb.mail import format_mail |
24 from cubicweb.mail import format_mail |
25 from cubicweb.web import ExplicitLogin, Redirect, RemoteCallFailed, json_dumps |
25 from cubicweb.web import ExplicitLogin, Redirect, RemoteCallFailed, DirectResponse, json_dumps |
26 from cubicweb.web.controller import Controller |
26 from cubicweb.web.controller import Controller |
27 from cubicweb.web.views import vid_from_rset |
27 from cubicweb.web.views import vid_from_rset |
28 from cubicweb.web.views.formrenderers import FormRenderer |
28 from cubicweb.web.views.formrenderers import FormRenderer |
|
29 |
29 try: |
30 try: |
30 from cubicweb.web.facet import (FilterRQLBuilder, get_facet, |
31 from cubicweb.web.facet import (FilterRQLBuilder, get_facet, |
31 prepare_facets_rqlst) |
32 prepare_facets_rqlst) |
32 HAS_SEARCH_RESTRICTION = True |
33 HAS_SEARCH_RESTRICTION = True |
33 except ImportError: # gae |
34 except ImportError: # gae |
277 if not isinstance(args, (list, tuple)): |
278 if not isinstance(args, (list, tuple)): |
278 args = (args,) |
279 args = (args,) |
279 args = [simplejson.loads(arg) for arg in args] |
280 args = [simplejson.loads(arg) for arg in args] |
280 try: |
281 try: |
281 result = func(*args) |
282 result = func(*args) |
282 except RemoteCallFailed: |
283 except (RemoteCallFailed, DirectResponse): |
283 raise |
284 raise |
284 except Exception, ex: |
285 except Exception, ex: |
285 self.exception('an exception occured while calling js_%s(%s): %s', |
286 self.exception('an exception occured while calling js_%s(%s): %s', |
286 fname, args, ex) |
287 fname, args, ex) |
287 raise RemoteCallFailed(repr(ex)) |
288 raise RemoteCallFailed(repr(ex)) |