Chengliang Yan
unread,Jul 10, 2012, 9:00:45 AM7/10/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web.py
I changed some lines of webpy code like this:
code of trunk:
>>>>
def handle_with_processors(self):
def process(processors):
try:
if processors:
p, processors = processors[0], processors[1:]
return p(lambda: process(processors))
else:
return self.handle()
except web.HTTPError:
raise
except (KeyboardInterrupt, SystemExit):
raise
except:
print >> web.debug, traceback.format_exc()
raise self.internalerror()
# processors must be applied in the resvere order. (??)
return process(self.processors)
code i changed to:
<<<<
def handle_with_processors(self):
def process_wrapper(processors):
try:
return process(processors)
except web.HTTPError:
raise
except (KeyboardInterrupt, SystemExit):
raise
except:
print >> web.debug, traceback.format_exc()
raise self.internalerror()
def process(processors):
if processors:
p, processors = processors[0], processors[1:]
return p(lambda: process(processors))
else:
return self.handle()
return process_wrapper(self.processors)
It solves the problem that apps' processors cann't catch exceptions of
their code.
Hope you can accept the code:)