From 9c1702f5c323a908f9d0da7eb764eb3423d14247 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 9 Aug 2013 04:49:10 -0500 Subject: [PATCH] richer structure in DISABLED --- VERSION | 2 +- applications/admin/controllers/default.py | 4 +--- gluon/main.py | 11 ++++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 61adbd43..1a02ba1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.08.09.04.38.18 +Version 2.6.0-development+timestamp.2013.08.09.04.48.26 diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 1d4bd433..2a6ce41f 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -491,13 +491,11 @@ def enable(): if is_gae: return SPAN(T('Not supported'), _style='color:yellow') elif os.path.exists(filename): - os.unlink(filename) return SPAN(T('Disable'), _style='color:green') else: - safe_open(filename, 'wb').write('time-disabled: %s' % request.now) + safe_open(filename, 'wb').write('disabled: True\ntime-disabled: %s' % request.now) return SPAN(T('Enable'), _style='color:red') - def peek(): """ Visualize object code """ app = get_app(request.vars.app) diff --git a/gluon/main.py b/gluon/main.py index c81ff216..9d879598 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -398,11 +398,12 @@ def wsgibase(environ, responder): 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

") + if data.get('disabled','True').lower() != 'false': + if 'redirect' in data: + redirect(data['redirect']) + if 'message' in data: + raise HTTP(503, data['message']) + raise HTTP(503, "

Temporarily down for maintenance

") # ################################################## # build missing folders