Commit b8b5f929 authored by Marc Duez's avatar Marc Duez
Browse files

controllers : cleaning

parent 3915c6cb
......@@ -13,7 +13,6 @@ if request.env.http_origin:
## return admin_panel
def index():
if auth.has_membership("admin"):
p = subprocess.Popen(["uptime"], stdout=subprocess.PIPE)
uptime, err = p.communicate()
......@@ -28,6 +27,11 @@ def index():
def monitor():
"""
>>> monitor().has_key('worker')
True
"""
# External monitor
last_results = ''
......@@ -42,10 +46,6 @@ def monitor():
running = len(db(db.scheduler_task.status=='RUNNING').select()),
last_results = last_results)
def worker():
if auth.has_membership("admin"):
return dict(message=T(''))
def log():
if auth.has_membership("admin"):
......@@ -85,8 +85,7 @@ def log():
if len(lines) >= 100 :
return dict(lines = lines)
return dict(lines = lines
)
return dict(lines = lines)
## to use after change in the upload folder
def repair_missing_files():
......
......@@ -6,14 +6,14 @@ if request.env.http_origin:
response.headers['Access-Control-Max-Age'] = 86400
def index():
if not auth.user :
res = {"redirect" : "default/user/login"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
if not auth.user :
res = {"redirect" : "default/user/login"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
query = db((auth.accessible_query('read', db.config) | auth.accessible_query('admin', db.config) ) ).select()
return dict(message=T('Configs'),
query = db((auth.accessible_query('read', db.config) | auth.accessible_query('admin', db.config) ) ).select()
return dict(message=T('Configs'),
query=query,
isAdmin = auth.has_membership("admin"))
......@@ -58,7 +58,7 @@ def edit_form():
error =""
required_fields = ['config_name', 'config_command', 'config_fuse_command', 'config_program']
required_fields = ['id', 'config_name', 'config_command', 'config_fuse_command', 'config_program']
for field in required_fields:
if request.vars[field] == "" :
error += field+" needed, "
......@@ -74,6 +74,7 @@ def edit_form():
res = {"redirect": "config/index",
"message": "config saved"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -278,6 +278,6 @@ def _init_log():
log = _init_log()
current.log = log
current.db = db
current.auth = auth
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment