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
--- 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