Mercurial > roundup-cc > roundup-cc
comparison display_issues_demo.py @ 21:7a523e13fcb3
Argpars added for the configuration file.
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Tue, 23 Oct 2018 13:06:16 +0200 |
parents | 3bb3d9a9f1b7 |
children | 89469aa41fe1 |
comparison
equal
deleted
inserted
replaced
20:3bb3d9a9f1b7 | 21:7a523e13fcb3 |
---|---|
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 """ |
15 import configparser | 15 import configparser |
16 import argparse | |
16 from display_issues import * | 17 from display_issues import * |
17 | 18 |
19 parser = argparse.ArgumentParser() | |
20 parser.add_argument("config_file", type=str, metavar="[config file]") | |
21 args = parser.parse_args() | |
22 | |
18 config = configparser.ConfigParser() | 23 config = configparser.ConfigParser() |
19 config.read('config3.ini') | 24 config.read(args.config_file) |
20 | 25 |
26 db = config.get("DB", "DatabaseFile") | |
21 keywords = config.get("SEARCH", "Keywords", fallback="") | 27 keywords = config.get("SEARCH", "Keywords", fallback="") |
22 status = config.get("SEARCH", "Status", fallback="") | 28 status = config.get("SEARCH", "Status", fallback="") |
23 columns = config.get("SEARCH", "Columns", fallback="critical, urgent, bug, feature, wish") | 29 columns = config.get("SEARCH", "Columns", fallback="critical, urgent, bug, feature, wish") |
24 noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) | 30 noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) |
25 if noPrio: | 31 if noPrio: |
26 columns += ", None" | 32 columns += ", None" |
27 | 33 |
28 cgitb.enable() # (optional) HTML traceback to browser | 34 cgitb.enable() # (optional) HTML traceback to browser |
29 #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) | 35 #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) |
30 render_db_stats_as_html("./demo3.db", | 36 render_db_stats_as_html(db, |
31 rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), | 37 rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), |
32 status, keywords) | 38 status, keywords) |