bernhard@3: #!/usr/bin/env python3 bernhard@3: bernhard@3: """ Fetch issues from a roundup-tracker and save them in a databse. bernhard@3: bernhard@3: author: Sascha L. Teichmann bernhard@3: author: Bernhard Reiter bernhard@3: author: Sean Engelhardt bernhard@3: bernhard@17: (c) 2010, 2015, 2018 by Intevation GmbH bernhard@3: bernhard@3: This is Free Software unter the terms of the bernhard@3: GNU GENERAL PUBLIC LICENSE Version 3 or later. bernhard@3: See http://www.gnu.org/licenses/gpl-3.0.txt for details bernhard@3: """ mschieder@20: import configparser mschieder@21: import argparse mschieder@20: from display_issues import * bernhard@3: mschieder@21: parser = argparse.ArgumentParser() mschieder@21: parser.add_argument("config_file", type=str, metavar="[config file]") mschieder@21: args = parser.parse_args() mschieder@21: mschieder@20: config = configparser.ConfigParser() mschieder@21: config.read(args.config_file) mschieder@20: mschieder@21: db = config.get("DB", "DatabaseFile") mschieder@20: keywords = config.get("SEARCH", "Keywords", fallback="") mschieder@20: status = config.get("SEARCH", "Status", fallback="") mschieder@20: columns = config.get("SEARCH", "Columns", fallback="critical, urgent, bug, feature, wish") mschieder@20: noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) mschieder@20: if noPrio: mschieder@20: columns += ", None" bernhard@3: bernhard@3: cgitb.enable() # (optional) HTML traceback to browser bernhard@17: #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) mschieder@21: render_db_stats_as_html(db, mschieder@20: rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), mschieder@20: status, keywords)