Commit 066c19f5 authored by Daniele Venzano's avatar Daniele Venzano

Small cleanups and fixes

parent 1a786b53
......@@ -57,7 +57,7 @@ class APIEndpoint:
ret = [e for e in execs if e.user_id == uid or role == 'admin']
return ret
def execution_start(self, uid, role_, exec_name, application_description):
def execution_start(self, uid, role_, exec_name, application_description) -> int:
"""Start an execution."""
try:
zoe_lib.applications.app_validate(application_description)
......
......@@ -57,7 +57,7 @@ def zoe_web_main() -> int:
app_settings = {
'static_path': os.path.join(os.path.dirname(__file__), "web", "static"),
'template_path': os.path.join(os.path.dirname(__file__), "web", "templates"),
# 'debug': args.debug
'debug': args.debug
}
app = Application(zoe_api.web.web_init(api_endpoint) + zoe_api.rest_api.api_init(api_endpoint), **app_settings)
JinjaApp.init_app(app)
......
......@@ -26,12 +26,8 @@ from zoe_lib.version import ZOE_API_VERSION, ZOE_VERSION
def web_init(api_endpoint) -> List[tornado.web.URLSpec]:
"""Flask init for the web interface."""
# def before_request():
# """Use the Flask global to hold the api endpoint reference."""
# g.api_endpoint = api_endpoint
"""Tornado init for the web interface."""
# web_bp = Blueprint('web', __name__, template_folder='templates', static_folder='static')
route_args = {
'api_endpoint': api_endpoint
}
......
......@@ -21,6 +21,7 @@
import json
import datetime
import logging
from jinja2 import Environment, FileSystemLoader, Markup
......@@ -28,9 +29,10 @@ from tornado.escape import squeeze, linkify, url_escape, xhtml_escape
import tornado.web
import zoe_lib.version
import zoe_api.web.utils
log = logging.getLogger(__name__)
class JinjaApp(object):
"""A Jinja2-capable Tornado application."""
......@@ -122,6 +124,7 @@ class ZoeRequestHandler(tornado.web.RequestHandler):
try:
html = self._render(template, **kwargs)
except Exception:
log.exception('Jinja2 template exception')
zoe_api.web.utils.error_page(self, 'Jinja2 template exception', 500)
return
self.finish(html)
......
......@@ -62,84 +62,84 @@ span.fakelink {
}
#wrapper {
width: 800px;
width: 800px;
}
#navigation {
background-color: #fff;
border: #ddd 1px solid;
border-radius: 10px;
margin: 10px;
padding: 10px;
background-color: #fff;
border: #ddd 1px solid;
border-radius: 10px;
margin: 10px;
padding: 10px;
}
#navigation li {
margin: 2px 0;
margin: 2px 0;
}
label.error {
color: #ff0000;
margin-left: 10px;
position: relative;
color: #ff0000;
margin-left: 10px;
position: relative;
}
.wizard {
background-color: #fff;
border: #ddd 1px solid;
border-radius: 10px;
margin: 10px;
padding: 10px;
background-color: #fff;
border: #ddd 1px solid;
border-radius: 10px;
margin: 10px;
padding: 10px;
}
.wizard .wizard-header {
background-color: #f4f4f4;
border-bottom: #ddd 1px solid;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 5px 10px;
margin: 0 0 10px 0;
background-color: #f4f4f4;
border-bottom: #ddd 1px solid;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 5px 10px;
margin: 0 0 10px 0;
}
.wizard .wizard-step {
margin: 10px 0;
margin: 10px 0;
}
.wizard .wizard-step p {
padding: 5px;
padding: 5px;
}
.navigation {
border-top: #ddd 1px solid;
margin-top: 10px;
padding-top: 10px;
border-top: #ddd 1px solid;
margin-top: 10px;
padding-top: 10px;
}
.navigation ul {
margin: 0;
padding: 0;
list-style: none;
margin: 0;
padding: 0;
list-style: none;
}
.navigation li {
float: left;
margin-right: 10px;
float: left;
margin-right: 10px;
}
.clearfix:before, .clearfix:after {
content: "\0020";
display: block;
height: 0;
visibility: hidden;
content: "\0020";
display: block;
height: 0;
visibility: hidden;
}
.clearfix:after {
clear: both;
clear: both;
}
input {
margin-top: 5px;
margin-top: 5px;
}
section {
padding-bottom: 10px;
}
\ No newline at end of file
}
......@@ -48,7 +48,7 @@ def catch_exceptions(func):
return error_page(self, str(e), 400)
except Exception as e:
log.exception(str(e))
return {'message': str(e)}, 500
return error_page(self, str(e), 500)
return func_wrapper
......
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