4 CherryPy application, which enables dynamic SQLite3 database file with release
5 comparison information browsing. Database file can be generated with
6 ``ValidationMatrix_v2.py`` script.
8 Author: Albertas Gimbutas, Vilnius University (LT)
9 e-mail: albertasgim@gmail.com
11 from __future__
import absolute_import
12 import cherrypy
as cpy
14 from os.path
import isfile
15 from jinja2
import Environment, FileSystemLoader, escape
16 from .app_utils
import *
18 env = Environment(loader=FileSystemLoader(
'templates'))
23 CherryPy application for release comparison browsing from SQLite3 database files.
24 The SQLite3 database files have to placed in the same directory as this script.
27 def default(self, db_name=None, release_title=None, st_test=None, file_id=None, *args, **kwargs):
28 """CherryPy controller, which handles all Http requests."""
30 threshold =
float(kwargs[
'threshold'])
34 context = {
'db_name':db_name,
'release_title':release_title,
35 'threshold': threshold,
'st_test':st_test,
36 'file_id':file_id,
'args':args,
'kwargs':kwargs}
40 db_list_temp = env.get_template(
'db_list.html')
43 return db_list_temp.render(context)
45 if not isfile(db_name +
'.db'):
47 context[
'error'] =
'Does not exist: %s.db' % db_name
48 return db_list_temp.render(context)
50 conn = sqlite3.connect(db_name +
'.db')
52 if not release_title
or not st_test:
53 rel_list_temp = env.get_template(
'release_list.html')
55 return rel_list_temp.render(context)
58 rel_summary_temp = env.get_template(
'release_summary.html')
61 return rel_summary_temp.render(context)
63 dir_summary_temp = env.get_template(
'directory_summary.html')
65 return dir_summary_temp.render(context)
68 if __name__ ==
'__main__':