can you accept this?

38 views
Skip to first unread message

Chengliang Yan

unread,
Jul 10, 2012, 9:00:45 AM7/10/12
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:)

Tomas Schertel

unread,
Jul 10, 2012, 10:12:23 AM7/10/12
to we...@googlegroups.com
Why don't you fill an issue or a pull request??
https://github.com/webpy/webpy/

Anand Chitipothu

unread,
Jul 10, 2012, 10:22:54 AM7/10/12
to we...@googlegroups.com
Looks good to me. Let me try it.

Anand
> --
> You received this message because you are subscribed to the Google Groups "web.py" group.
> To post to this group, send email to we...@googlegroups.com.
> To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
>

Chengliang Yan

unread,
Jul 10, 2012, 10:07:13 PM7/10/12
to we...@googlegroups.com
Thanks,Anand;)

在 2012年7月10日星期二UTC+8下午10时22分54秒,Anand写道:
> To unsubscribe from this group, send email to webpy+unsubscribe@googlegroups.com.

Zagfai Kwong

unread,
Jul 11, 2012, 4:42:55 AM7/11/12
to we...@googlegroups.com
a bit better but will not change the strange of webpy :)

Chengliang Yan於 2012年7月10日星期二UTC+8下午9時00分45秒寫道:
Reply all
Reply to author
Forward
0 new messages