Permalink
Browse files

Fixed possible traceback error due to parameter list substitution bug.

  • Loading branch information...
1 parent 170098a commit e5170d956b23688208e951e37b6e473df4fbb0e4 Josh Marshall committed Oct 30, 2010
Showing with 10 additions and 9 deletions.
  1. +2 −0 .gitignore
  2. +7 −8 tornadorpc/base.py
  3. +1 −1 tornadorpc/json.py
View
@@ -0,0 +1,2 @@
+*.pyc
+build/
View
@@ -22,7 +22,12 @@
"""
from tornado.web import RequestHandler
+import tornado.web
+import tornado.ioloop
+import tornado.httpserver
import types
+import types
@FlorianLudwig
FlorianLudwig Oct 30, 2010

types is already imported, just one line above :)

+import traceback
# Configuration element
class Config(object):
@@ -150,18 +155,16 @@ def dispatch(self, method_name, params):
return self.faults.invalid_params()
def traceback(self, method_name='REQUEST', params=[]):
- import traceback
err_lines = traceback.format_exc().splitlines()
err_title = "ERROR IN %s" % method_name
if len(params) > 0:
- err_title += ' - (PARAMS: %s)' % params
+ err_title = '%s - (PARAMS: %s)' % (err_title, repr(params))
err_sep = ('-'*len(err_title))[:79]
err_lines = [err_sep, err_title, err_sep]+err_lines
- global config
if config.verbose == True:
if len(err_lines) >= 7 and config.short_errors:
# Minimum number of lines to see what happened
- # Plust title and separators
+ # Plus title and separators
print '\n'.join(err_lines[0:4]+err_lines[-3:])
else:
print '\n'.join(err_lines)
@@ -306,10 +309,6 @@ def start_server(handlers, route=r'/', port=8080):
USAGE:
start_server(handler_class, route=r'/', port=8181)
"""
- import tornado.web
- import tornado.ioloop
- import tornado.httpserver
- import types
if type(handlers) not in (types.ListType, types.TupleType):
handler = handlers
handlers = [(route, handler),]
View
@@ -29,7 +29,7 @@
It requires the jsonrpclib, which you can get from:
- http://code.google.com/p/jsonrpclib/
+ http://github.com/joshmarshall/jsonrpclib
Also, you will need one of the following JSON modules:
* cjson

0 comments on commit e5170d9

Please sign in to comment.