a bit better but will not change the strange of webpy :)

Chengliang Yan於 2012年7月10日星期二UTC+8下午9時00分45秒寫道:
>
> 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:)

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/6W94q6KCMs0J.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to