richer structure in DISABLED
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ def enable():
|
|||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
return SPAN(T('Disable'), _style='color:green')
|
return SPAN(T('Disable'), _style='color:green')
|
||||||
else:
|
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')
|
return SPAN(T('Enable'), _style='color:red')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -379,7 +379,8 @@ def wsgibase(environ, responder):
|
|||||||
# ##################################################
|
# ##################################################
|
||||||
# access the requested application
|
# access the requested application
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|
||||||
|
disabled = pjoin(request.folder, 'DISABLED')
|
||||||
if not exists(request.folder):
|
if not exists(request.folder):
|
||||||
if app == rwthread.routes.default_application \
|
if app == rwthread.routes.default_application \
|
||||||
and app != 'welcome':
|
and app != 'welcome':
|
||||||
@@ -394,8 +395,13 @@ def wsgibase(environ, responder):
|
|||||||
raise HTTP(404, rwthread.routes.error_message
|
raise HTTP(404, rwthread.routes.error_message
|
||||||
% 'invalid request',
|
% 'invalid request',
|
||||||
web2py_error='invalid application')
|
web2py_error='invalid application')
|
||||||
elif not request.is_local and \
|
elif request.is_local and exists(disabled):
|
||||||
exists(pjoin(request.folder, '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>")
|
raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
|
||||||
|
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user