Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions itty.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def convert_to_ascii(self, data):
if isinstance(data, unicode):
try:
return data.encode('us-ascii')
except UnicodeError, e:
except UnicodeError as e:
raise
else:
return str(data)
Expand All @@ -271,13 +271,13 @@ def handle_request(environ, start_response):
"""The main handler. Dispatches to the user's code."""
try:
request = Request(environ, start_response)
except Exception, e:
except Exception as e:
return handle_error(e)

try:
(re_url, url, callback), kwargs = find_matching_url(request)
response = callback(request, **kwargs)
except Exception, e:
except Exception as e:
return handle_error(e, request)

if not isinstance(response, Response):
Expand Down Expand Up @@ -616,12 +616,12 @@ def run_itty(server='wsgiref', host='localhost', port=8080, config=None):

# AppEngine seems to echo everything, even though it shouldn't. Accomodate.
if server != 'appengine':
print 'itty starting up (using %s)...' % server
print 'Listening on http://%s:%s...' % (host, port)
print 'Use Ctrl-C to quit.'
print
print('itty starting up (using %s)...' % server)
print('Listening on http://%s:%s...' % (host, port))
print('Use Ctrl-C to quit.')
print()

try:
WSGI_ADAPTERS[server](host, port)
except KeyboardInterrupt:
print 'Shutting down. Have a nice day!'
print('Shutting down. Have a nice day!')