web/views/basecontrollers.py
changeset 5159 2543cfa5d54a
parent 5155 1dea6e0fdfc1
parent 5151 2f70fa8b6854
child 5174 78438ad513ca
equal deleted inserted replaced
5158:5e9055b8c10a 5159:2543cfa5d54a
   275             raise RemoteCallFailed('no %s method' % fname)
   275             raise RemoteCallFailed('no %s method' % fname)
   276         # no <arg> attribute means the callback takes no argument
   276         # no <arg> attribute means the callback takes no argument
   277         args = self._cw.form.get('arg', ())
   277         args = self._cw.form.get('arg', ())
   278         if not isinstance(args, (list, tuple)):
   278         if not isinstance(args, (list, tuple)):
   279             args = (args,)
   279             args = (args,)
   280         args = [simplejson.loads(arg) for arg in args]
   280         try:
       
   281             args = [simplejson.loads(arg) for arg in args]
       
   282         except ValueError, exc:
       
   283             self.exception('error while decoding json arguments for js_%s: %s', fname, args, exc)
       
   284             raise RemoteCallFailed(repr(exc))
   281         try:
   285         try:
   282             result = func(*args)
   286             result = func(*args)
   283         except (RemoteCallFailed, DirectResponse):
   287         except (RemoteCallFailed, DirectResponse):
   284             raise
   288             raise
   285         except Exception, ex:
   289         except Exception, ex:
   440         args['reload'] = simplejson.loads(args['reload'])
   444         args['reload'] = simplejson.loads(args['reload'])
   441         rset = req.eid_rset(int(self._cw.form['eid']))
   445         rset = req.eid_rset(int(self._cw.form['eid']))
   442         view = req.vreg['views'].select('doreledit', req, rset=rset, rtype=args['rtype'])
   446         view = req.vreg['views'].select('doreledit', req, rset=rset, rtype=args['rtype'])
   443         stream = view.set_stream()
   447         stream = view.set_stream()
   444         view.render(**args)
   448         view.render(**args)
       
   449         # XXX why not _call_view ?
   445         extresources = req.html_headers.getvalue(skiphead=True)
   450         extresources = req.html_headers.getvalue(skiphead=True)
   446         if extresources:
   451         if extresources:
   447             stream.write(u'<div class="ajaxHtmlHead">\n')
   452             stream.write(u'<div class="ajaxHtmlHead">\n')
   448             stream.write(extresources)
   453             stream.write(extresources)
   449             stream.write(u'</div>\n')
   454             stream.write(u'</div>\n')