# HG changeset patch # User Sverre Rabbelier # Date 1236556813 0 # Node ID cf39e8705fac2afc6d981c340dbad95a2747abde # Parent 393891d794e2494d42588c8852dbae921dd5022d Except and properly handle Errors in view decorator After the next release we can remove all try/except combinations that are not customized and leave the handling of those exceptions to the view decorator. Patch by: Sverre Rabbelier diff -r 393891d794e2 -r cf39e8705fac app/soc/views/helper/decorators.py --- a/app/soc/views/helper/decorators.py Sun Mar 08 23:58:27 2009 +0000 +++ b/app/soc/views/helper/decorators.py Mon Mar 09 00:00:13 2009 +0000 @@ -47,6 +47,8 @@ from soc.logic.helper import timeline from soc.logic.models.site import logic as site_logic from soc.logic.models.user import logic as user_logic + from soc.views import out_of_band + from soc.views.helper import responses @wraps(func) def view_wrapper(request, *args, **kwds): @@ -73,6 +75,8 @@ except AssertionError, exception: logging.exception(exception) return http.HttpResponseRedirect('/soc/content/assertion_error.html') + except out_of_band.Error, error: + return responses.errorResponse(error, request) return view_wrapper