From e648a9ebbb2bae9112d13986cc7d827062fcb39c Mon Sep 17 00:00:00 2001 From: ianb Date: Sat, 7 May 2005 03:07:39 +0000 Subject: Remember to use 'new', fix a couple small bugs --- examples/console/JSONComponent/jsoncomponent.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'examples/console') diff --git a/examples/console/JSONComponent/jsoncomponent.py b/examples/console/JSONComponent/jsoncomponent.py index a7f65c6..e4af31c 100644 --- a/examples/console/JSONComponent/jsoncomponent.py +++ b/examples/console/JSONComponent/jsoncomponent.py @@ -36,17 +36,18 @@ class JSONServletComponent(ServletComponent): raise HTTPForbidden( "The method %s is not public" % method_name) method = getattr(self.servlet(), method_name) - result = method(*json_req['params']) + result = method(*req_data['params']) json_res = {'id': req_id, 'result': result, 'error': None} json_res = objToJson(json_res) except Exception, e: if isinstance(e, httpexceptions.HTTPException): raise out = StringIO() + # @@: I should also report this error traceback.print_exc(file=out) json_res = {'id': req_id, 'result': None, 'error': out.getvalue()} - json_res = objToJon(json_res) + json_res = objToJson(json_res) self.servlet().response().write(json_res) self.servlet().setView(None) @@ -62,6 +63,7 @@ class JSONServletComponent(ServletComponent): base = base_base + '/' + base if not lib.startswith('/'): lib = base_base + '/' + lib + base = 'jsolait' text = (r''' @@ -69,7 +71,7 @@ class JSONServletComponent(ServletComponent): ''' % {'base': base, -- cgit v1.2.1