Place the getSingleton call in view decorator in the try
This way timeouts on the getSingleton() call are also catched.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/decorators.py Mon Apr 13 21:32:29 2009 +0000
+++ b/app/soc/views/helper/decorators.py Mon Apr 13 21:46:33 2009 +0000
@@ -57,15 +57,16 @@
def view_wrapper(request, *args, **kwds):
"""View decorator wrapper method.
"""
- site = site_logic.getSingleton()
-
- # don't redirect admins, or if we're at /maintenance already
- no_redirect = user_logic.isDeveloper() or request.path == '/maintenance'
-
- if (not no_redirect) and timeline.isActivePeriod(site, 'maintenance'):
- return http.HttpResponseRedirect('/maintenance')
try:
+ site = site_logic.getSingleton()
+
+ # don't redirect admins, or if we're at /maintenance already
+ no_redirect = user_logic.isDeveloper() or request.path == '/maintenance'
+
+ if (not no_redirect) and timeline.isActivePeriod(site, 'maintenance'):
+ return http.HttpResponseRedirect('/maintenance')
+
return func(request, *args, **kwds)
except DeadlineExceededError, exception:
logging.exception(exception)