app/soc/views/helper/decorators.py
changeset 2181 3ebe6cb63aa0
parent 2077 fd2e83a297c7
child 2392 b53e1cdb0398
equal deleted inserted replaced
2180:7b8dcd7aab75 2181:3ebe6cb63aa0
    55 
    55 
    56   @wraps(func)
    56   @wraps(func)
    57   def view_wrapper(request, *args, **kwds):
    57   def view_wrapper(request, *args, **kwds):
    58     """View decorator wrapper method.
    58     """View decorator wrapper method.
    59     """
    59     """
    60     site = site_logic.getSingleton()
       
    61 
       
    62     # don't redirect admins, or if we're at /maintenance already
       
    63     no_redirect = user_logic.isDeveloper() or request.path == '/maintenance'
       
    64 
       
    65     if (not no_redirect) and timeline.isActivePeriod(site, 'maintenance'):
       
    66       return http.HttpResponseRedirect('/maintenance')
       
    67 
    60 
    68     try:
    61     try:
       
    62       site = site_logic.getSingleton()
       
    63 
       
    64       # don't redirect admins, or if we're at /maintenance already
       
    65       no_redirect = user_logic.isDeveloper() or request.path == '/maintenance'
       
    66 
       
    67       if (not no_redirect) and timeline.isActivePeriod(site, 'maintenance'):
       
    68         return http.HttpResponseRedirect('/maintenance')
       
    69 
    69       return func(request, *args, **kwds)
    70       return func(request, *args, **kwds)
    70     except DeadlineExceededError, exception:
    71     except DeadlineExceededError, exception:
    71       logging.exception(exception)
    72       logging.exception(exception)
    72       return http.HttpResponseRedirect('/soc/content/deadline_exceeded.html')
    73       return http.HttpResponseRedirect('/soc/content/deadline_exceeded.html')
    73     except CapabilityDisabledError, exception:
    74     except CapabilityDisabledError, exception: