fixed problem with ENABLED/DISABLED, issue 1689

This commit is contained in:
Massimo
2013-09-24 13:29:54 -05:00
parent c4042dc475
commit b67141b1ef
4 changed files with 5 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.6.4-stable+timestamp.2013.09.23.16.32.10 Version 2.6.4-stable+timestamp.2013.09.24.13.29.22
@@ -494,6 +494,7 @@ def enable():
if is_gae: if is_gae:
return SPAN(T('Not supported'), _style='color:yellow') return SPAN(T('Not supported'), _style='color:yellow')
elif os.path.exists(filename): elif os.path.exists(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('disabled: True\ntime-disabled: %s' % request.now) safe_open(filename, 'wb').write('disabled: True\ntime-disabled: %s' % request.now)
+1 -1
View File
@@ -54,7 +54,7 @@
{{pass}} {{pass}}
</ul> </ul>
</div> </div>
{{=button_enable(URL('enable',args=a), a)}} {{=button_enable(URL('enable',args=a), a) if a!='admin' else ''}}
</td> </td>
</tr> </tr>
{{pass}} {{pass}}
+2 -9
View File
@@ -396,15 +396,8 @@ 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 request.is_local and exists(disabled): elif not request.is_local and exists(disabled):
data = dict([item.strip() for item in line.split(':',1)] raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
for line in open(disabled) if line.strip())
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, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
# ################################################## # ##################################################
# build missing folders # build missing folders