richer structure in DISABLED

This commit is contained in:
mdipierro
2013-08-09 04:39:01 -05:00
parent c6a3a8f61a
commit a3222f601a
3 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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')
+9 -3
View File
@@ -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, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
# ##################################################