# HG changeset patch # User Magnus Schieder # Date 1542128110 -3600 # Node ID 761ee2351f587ba2f610f64c23c60d46a6d1e67c # Parent 7161ce4e7ab117265518b97e588a12e04a33d9da Change the parameter read in. * The structure was changed and better names used. diff -r 7161ce4e7ab1 -r 761ee2351f58 collect_issues.py --- a/collect_issues.py Mon Nov 12 18:03:26 2018 +0100 +++ b/collect_issues.py Tue Nov 13 17:55:10 2018 +0100 @@ -169,8 +169,6 @@ elif search == "status": order_csv = get_csv_from_server(opener, baseurl, CHECK_ROUNDUP_ORDER_STATUS) formated_search_url = SEARCH_ROUNDUP_STATUS.format(keyword_values=keywords_ids_url) - else: - print("Incorrect search parameter. (prio, status)") current_issues_csv = get_csv_from_server(opener, baseurl, formated_search_url) diff -r 7161ce4e7ab1 -r 761ee2351f58 display_issues_demo.py --- a/display_issues_demo.py Mon Nov 12 18:03:26 2018 +0100 +++ b/display_issues_demo.py Tue Nov 13 17:55:10 2018 +0100 @@ -16,36 +16,43 @@ import argparse from display_issues import * -STATES = "unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved" - -parser = argparse.ArgumentParser() -parser.add_argument("config_file", type=str, metavar="[config file]") -args = parser.parse_args() +def main(): + PRIO = "critical, urgent, bug, feature, wish" + STATES = "unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved" -config = configparser.ConfigParser() -config.read(args.config_file) + parser = argparse.ArgumentParser() + parser.add_argument("config_file", type=str, metavar="[config file]") + args = parser.parse_args() -db = config.get("DB", "DatabaseFile") -keywords = config.get("SEARCH", "Keywords", fallback="") + config = configparser.ConfigParser() + config.read(args.config_file) + db = config.get("DB", "DatabaseFile") + keywords = config.get("SEARCH", "Keywords", fallback="") -status = config.get("SEARCH", "Status", fallback="") -columns = config.get("SEARCH", "Columns", fallback="critical, urgent, bug, feature, wish") -noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) -search = config.get("SEARCH", "Search", fallback="prio") -if search == "status": - if status == "": - columns = STATES + search = config.get("SEARCH", "Search", fallback="prio") + if search == "prio": + status = config.get("SEARCH", "Status", fallback="") + columns = config.get("SEARCH", "Priority", fallback=PRIO) + noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) + if noPrio: + columns += ", None" + + elif search == "status": + columns = config.get("SEARCH", "Status", fallback=STATES) + status = "" + else: - columns = status - noPrio = False + print("Incorrect [SEARCH]Search parameter. (prio, status)") + return -if noPrio: - columns += ", None" -cgitb.enable() # (optional) HTML traceback to browser -#render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) -render_db_stats_as_html(db, - rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), - columns, status, keywords) + cgitb.enable() # (optional) HTML traceback to browser + #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) + render_db_stats_as_html(db, + rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), + columns, status, keywords) + +if __name__ == '__main__': + main() diff -r 7161ce4e7ab1 -r 761ee2351f58 examples/config.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/config.ini Tue Nov 13 17:55:10 2018 +0100 @@ -0,0 +1,16 @@ +[URL] +BaseURL = http://localhost:8917/demo/ + +[LOGIN] +Username = demo +Password = demo + +[DB] +DatabaseFile = ./demo.db + +[SEARCH] +Search = prio +Keywords = keywords1, keyword2, keyword3 +Priority = critical, urgent, bug, feature, wish +Status = unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved +IncludeNoPrio = True diff -r 7161ce4e7ab1 -r 761ee2351f58 examples/config3.ini --- a/examples/config3.ini Mon Nov 12 18:03:26 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -[URL] -BaseURL = http://localhost:8917/demo/ - -[LOGIN] -Username = demo -Password = demo - -[DB] -DatabaseFile = ./demo3.db - -[SEARCH] -Keywords = keywords1, keyword2, keyword3 -Columns = critical, urgent, bug, feature, wish -Status = unread, deferred, chatting, need-eg, in-progress, testing, done-cbb, resolved -IncludeNoPrio = True diff -r 7161ce4e7ab1 -r 761ee2351f58 roundup_cc.py --- a/roundup_cc.py Mon Nov 12 18:03:26 2018 +0100 +++ b/roundup_cc.py Tue Nov 13 17:55:10 2018 +0100 @@ -39,7 +39,7 @@ search = config.get("SEARCH", "Search", fallback="prio") if search == "prio": - list_of_columns = config.get("SEARCH", "Columns", fallback=PRIO).split(", ") + list_of_columns = config.get("SEARCH", "Priority", fallback=PRIO).split(", ") status = config.get("SEARCH", "Status", fallback="").split(", ") include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) if include_no_prio: @@ -49,6 +49,10 @@ list_of_columns = config.get("SEARCH", "Status", fallback=STATES).split(", ") status = [""] + else: + print("Incorrect [SEARCH]Search parameter. (prio, status)") + return + select_all, select_where, create_db, insert_new = \ rcd.build_sql_commands(list_of_columns)