comparison display_issues.py @ 32:80bbd06fe8ec

Add Comments
author Magnus Schieder <mschieder@intevation.de>
date Fri, 23 Nov 2018 16:13:24 +0100
parents 9aca070c86bd
children
comparison
equal deleted inserted replaced
31:9aca070c86bd 32:80bbd06fe8ec
3 """ Display previously saved issues from a database on webpage via CGI. 3 """ Display previously saved issues from a database on webpage via CGI.
4 4
5 author: Sascha L. Teichmann <sascha.teichmann@intevation.de> 5 author: Sascha L. Teichmann <sascha.teichmann@intevation.de>
6 author: Bernhard Reiter <bernhard@intevation.de> 6 author: Bernhard Reiter <bernhard@intevation.de>
7 author: Sean Engelhardt <sean.engelhardt@intevation.de> 7 author: Sean Engelhardt <sean.engelhardt@intevation.de>
8 8 author: Magnus Schieder <magnus.schieder@intevation.de>
9 (c) 2010,2015 by Intevation GmbH 9 (c) 2010,2015,2018 by Intevation GmbH
10 10
11 This is Free Software unter the terms of the 11 This is Free Software unter the terms of the
12 GNU GENERAL PUBLIC LICENSE Version 3 or later. 12 GNU GENERAL PUBLIC LICENSE Version 3 or later.
13 See http://www.gnu.org/licenses/gpl-3.0.txt for details 13 See http://www.gnu.org/licenses/gpl-3.0.txt for details
14 14
39 formated.append("{date : new Date('" + str(item) + "')}") 39 formated.append("{date : new Date('" + str(item) + "')}")
40 40
41 return ", ".join(formated) 41 return ", ".join(formated)
42 42
43 def get_webpage(data_dict, columns, search_parameters, keywords, graph=None): 43 def get_webpage(data_dict, columns, search_parameters, keywords, graph=None):
44 """Returns the website with inserted data."""
44 45
45 if graph is None: 46 if graph is None:
46 graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html' 47 graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html'
47 48
48 with open(graph, "r") as html_chart_file: 49 with open(graph, "r") as html_chart_file:
49 base_html_data = html_chart_file.read() 50 base_html_data = html_chart_file.read()
50 51
51 if "None" not in columns: 52 if "None" not in columns:
52 data_dict["None"] = [0] 53 data_dict["None"] = [0]
53 54
54 55 # Converts the data to a JS object.
55 js_data_dickt ="{" 56 js_data_dickt ="{"
56 for col in columns.split(", "): 57 for col in columns.split(", "):
57 js_data_dickt += col + ":[" + make_js_object_string(data_dict[col]) + "]," 58 js_data_dickt += col + ":[" + make_js_object_string(data_dict[col]) + "],"
58 js_data_dickt += "}" 59 js_data_dickt += "}"
59 60
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)