diff --git a/VERSION b/VERSION index dc411cfb..61adbd43 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.08.09.03.37.59 +Version 2.6.0-development+timestamp.2013.08.09.04.38.18 diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 490fa907..1d4bd433 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -494,7 +494,7 @@ def enable(): os.unlink(filename) return SPAN(T('Disable'), _style='color:green') else: - safe_open(filename, 'wb').write(time.ctime()) + safe_open(filename, 'wb').write('time-disabled: %s' % request.now) return SPAN(T('Enable'), _style='color:red') diff --git a/gluon/main.py b/gluon/main.py index 53f426b4..c81ff216 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -379,7 +379,8 @@ def wsgibase(environ, responder): # ################################################## # access the requested application # ################################################## - + + disabled = pjoin(request.folder, 'DISABLED') if not exists(request.folder): if app == rwthread.routes.default_application \ and app != 'welcome': @@ -394,8 +395,13 @@ def wsgibase(environ, responder): raise HTTP(404, rwthread.routes.error_message % 'invalid request', web2py_error='invalid application') - elif not request.is_local and \ - exists(pjoin(request.folder, 'DISABLED')): + elif request.is_local and exists(disabled): + data = dict([item.strip() for item in line.split(':',1)] + for line in open(disabled) if line.strip()) + if 'redirect' in data: + redirect(data['redirect']) + if 'message' in data: + raise HTTP(503, data['message']) raise HTTP(503, "

Temporarily down for maintenance

") # ##################################################