changeset 34:916fa83b4144

Clean up repository. 'Update README.creole' * /doc added for the old demos. * Added comments to config.ini.
author Magnus Schieder <mschieder@intevation.de>
date Mon, 26 Nov 2018 16:08:27 +0100
parents 946b9f458fcc
children b07588ac28b6
files README.creole config.ini doc/collect_demo1.py doc/collect_demo2.py doc/collect_demo3.py doc/old_README.creole examples/collect_demo1.py examples/collect_demo2.py examples/collect_demo3.py examples/config.ini
diffstat 10 files changed, 188 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/README.creole	Fri Nov 23 17:10:29 2018 +0100
+++ b/README.creole	Mon Nov 26 16:08:27 2018 +0100
@@ -5,35 +5,23 @@
 It is Free Software, check out the file headers.
 
 === Example
-Run ./demo.py from a roundup-tracker to have a running tracker.
+Run ./roundup_cc.py from a roundup-tracker to have a running tracker.
 
 {{{
-cp examples/collect_demo3.py c3.py
-cp examples/config3.ini .
-# change config3.ini
-./c3.py config3.ini
+# Edit config.ini
+# An example can be found under /examples/config.ini
+./roundup_cc.py config.ini
 # create or change some issues
-./c3.py config3.ini
+./roundup_cc.py config.ini
+
 
 # to inspect the database contents
-sqlite3 demo3.db 'select * from issues;'
-
-./display_issues_demo.py config3.ini >demo3.html
-chromium demo3.html
+sqlite3 demo.db 'select * from issues;'
+./roundup_cc_display.py config.ini > demo.html
+chromium demo.html
 }}}
 
 
-=== Notes
-examples/collect_demo2.py builds database column names dynamically
-and tracks issues with priorities. The display part is still missing.
-
-When migrating to 3:99c68ebfb3b9, Nov 30 17:46:22 2015
-you need to add the print statements for the content-type header
-to all of your cgi scripts.
-
-Bottledash may have a fork
-https://wald.intevation.org/hg/bottledash/file/tip/modules/web_view
-
 === Prerequisites
 
 Python v3, with build-in sqlite3 module.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config.ini	Mon Nov 26 16:08:27 2018 +0100
@@ -0,0 +1,32 @@
+[URL]
+# URL of the tracker
+BaseURL =
+
+[LOGIN]
+Username =
+Password =
+
+[DB]
+# Path of the database in which the data is to be stored.
+DatabaseFile =
+
+[SEARCH]
+# Determines whether priorities or statuses are counted (default: prio).
+Search = prio/status
+
+# Determines which priorities are searched for.
+# (Default if 'Search=prio': critical, urgent, bug, feature, wish)
+# (Default if 'Search=status': All priorities that are available in the Tracker, also 'None'.)
+Priority =
+
+# If True is selected, the issues that have no priority are also counted (default: False).
+IncludeNoPrio = True/False
+
+# Determines which statuses are searched for.
+# (Default if 'Search=status': unread, deferred, chatting, need-eg, in-progress, testing, done-cbb)
+# (Default if 'Search=prio': All statuses that are available in the Tracker.)
+Status =
+
+# Determines which keywords are searched for.
+# (default: Keywords are not included in the search.)
+Keywords =
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/collect_demo1.py	Mon Nov 26 16:08:27 2018 +0100
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+"""Connect to roundup-tracker and save status to db for example demo1.
+
+Run periodically as often as you want data points to be saved.
+demo1 only tracks issues with a priority.
+"""
+from collect_issues import save_stats_in_db
+import roundup_content_data as rcd
+
+BASE_URL_DEMO = "http://localhost:8917/demo/"
+SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7"
+
+LOGIN_PARAMETERS_DEMO = (
+    ("__login_name", "demo"),
+    ("__login_password", "demo"),
+    ("@action", "Login"),
+    )
+
+save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo1.py",
+                 rcd.COLUMNS, rcd.CREATE_DB, rcd.INSERT_NEW, SEARCH_URL_DEMO)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/collect_demo2.py	Mon Nov 26 16:08:27 2018 +0100
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+"""Connect to roundup-tracker and save status to db for example demo2.
+
+Run periodically as often as you want data points to be saved.
+demo2 tracks issue without priority in column `None`.
+"""
+from collect_issues import save_stats_in_db
+import roundup_content_data as rcd
+
+BASE_URL_DEMO = "http://localhost:8917/demo/"
+SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7"
+
+LOGIN_PARAMETERS_DEMO = (
+    ("__login_name", "demo"),
+    ("__login_password", "demo"),
+    ("@action", "Login"),
+    )
+
+list_of_columns = ['critical', 'major', 'normal', 'minor', 'wishlist']
+data_dict = { key: [] for key in list_of_columns }
+
+# To track issues without prio we need to add an extra column in the db cmds.
+select_all, select_where, create_db, insert_new = \
+    rcd.build_sql_commands(list_of_columns + ['None'])
+
+# We enable the extra colum with `include_no_prio=True`
+save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo2.db",
+                 list_of_columns, create_db, insert_new,
+                 SEARCH_URL_DEMO, include_no_prio=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/collect_demo3.py	Mon Nov 26 16:08:27 2018 +0100
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+"""Connect to roundup-tracker and save status to db for example demo1.
+
+Run periodically as often as you want data points to be saved.
+demo1 only tracks issues with a priority.
+"""
+
+import json
+import configparser
+import argparse
+
+from collect_issues import save_stats_in_db
+import roundup_content_data as rcd
+
+COLUMNS = "critical, urgent, bug, feature, wish"
+
+parser = argparse.ArgumentParser()
+parser.add_argument("config_file", type=str, metavar="[config file]")
+args = parser.parse_args()
+
+config = configparser.ConfigParser()
+config.read(args.config_file)
+
+base_url = config.get("URL", "BaseURL")
+
+user = config.get("LOGIN","Username")
+password = config.get("LOGIN", "Password")
+
+LOGIN_PARAMETERS_DEMO = (
+    ("__login_name", user),
+    ("__login_password", password),
+    ("@action", "Login"),
+    )
+
+database_file = config.get("DB", "DatabaseFile")
+
+keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")
+
+list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ")
+
+status = config.get("SEARCH", "Status", fallback="").split(", ")
+
+include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
+
+if include_no_prio:
+    list_of_columns += ["None"]
+
+select_all, select_where, create_db, insert_new = \
+    rcd.build_sql_commands(list_of_columns)
+
+save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file,
+                list_of_columns, create_db, insert_new, keywords, status)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/old_README.creole	Mon Nov 26 16:08:27 2018 +0100
@@ -0,0 +1,44 @@
+= Roundup Issue Collector
+
+Grab and display data from a http://roundup-tracker.org/ instance.
+
+It is Free Software, check out the file headers.
+
+=== Example
+Run ./demo.py from a roundup-tracker to have a running tracker.
+
+{{{
+cp examples/collect_demo3.py c3.py
+cp examples/config3.ini .
+# change config3.ini
+./c3.py config3.ini
+# create or change some issues
+./c3.py config3.ini
+
+# to inspect the database contents
+sqlite3 demo3.db 'select * from issues;'
+
+./display_issues_demo.py config3.ini >demo3.html
+chromium demo3.html
+}}}
+
+
+=== Notes
+examples/collect_demo2.py builds database column names dynamically
+and tracks issues with priorities. The display part is still missing.
+
+When migrating to 3:99c68ebfb3b9, Nov 30 17:46:22 2015
+you need to add the print statements for the content-type header
+to all of your cgi scripts.
+
+Bottledash may have a fork
+https://wald.intevation.org/hg/bottledash/file/tip/modules/web_view
+
+=== Prerequisites
+
+Python v3, with build-in sqlite3 module.
+
+=== Included
+
+http://d3js.org/    initially used with 3.5.5
+  """Library released under BSD license. Copyright 2015 Mike Bostock."
--- a/examples/collect_demo1.py	Fri Nov 23 17:10:29 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#!/usr/bin/env python3
-"""Connect to roundup-tracker and save status to db for example demo1.
-
-Run periodically as often as you want data points to be saved.
-demo1 only tracks issues with a priority.
-"""
-from collect_issues import save_stats_in_db
-import roundup_content_data as rcd
-
-BASE_URL_DEMO = "http://localhost:8917/demo/"
-SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7"
-
-LOGIN_PARAMETERS_DEMO = (
-    ("__login_name", "demo"),
-    ("__login_password", "demo"),
-    ("@action", "Login"),
-    )
-
-save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo1.py",
-                 rcd.COLUMNS, rcd.CREATE_DB, rcd.INSERT_NEW, SEARCH_URL_DEMO)
--- a/examples/collect_demo2.py	Fri Nov 23 17:10:29 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#!/usr/bin/env python3
-"""Connect to roundup-tracker and save status to db for example demo2.
-
-Run periodically as often as you want data points to be saved.
-demo2 tracks issue without priority in column `None`.
-"""
-from collect_issues import save_stats_in_db
-import roundup_content_data as rcd
-
-BASE_URL_DEMO = "http://localhost:8917/demo/"
-SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7"
-
-LOGIN_PARAMETERS_DEMO = (
-    ("__login_name", "demo"),
-    ("__login_password", "demo"),
-    ("@action", "Login"),
-    )
-
-list_of_columns = ['critical', 'major', 'normal', 'minor', 'wishlist']
-data_dict = { key: [] for key in list_of_columns }
-
-# To track issues without prio we need to add an extra column in the db cmds.
-select_all, select_where, create_db, insert_new = \
-    rcd.build_sql_commands(list_of_columns + ['None'])
-
-# We enable the extra colum with `include_no_prio=True`
-save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo2.db",
-                 list_of_columns, create_db, insert_new,
-                 SEARCH_URL_DEMO, include_no_prio=True)
--- a/examples/collect_demo3.py	Fri Nov 23 17:10:29 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#!/usr/bin/env python3
-"""Connect to roundup-tracker and save status to db for example demo1.
-
-Run periodically as often as you want data points to be saved.
-demo1 only tracks issues with a priority.
-"""
-
-import json
-import configparser
-import argparse
-
-from collect_issues import save_stats_in_db
-import roundup_content_data as rcd
-
-COLUMNS = "critical, urgent, bug, feature, wish"
-
-parser = argparse.ArgumentParser()
-parser.add_argument("config_file", type=str, metavar="[config file]")
-args = parser.parse_args()
-
-config = configparser.ConfigParser()
-config.read(args.config_file)
-
-base_url = config.get("URL", "BaseURL")
-
-user = config.get("LOGIN","Username")
-password = config.get("LOGIN", "Password")
-
-LOGIN_PARAMETERS_DEMO = (
-    ("__login_name", user),
-    ("__login_password", password),
-    ("@action", "Login"),
-    )
-
-database_file = config.get("DB", "DatabaseFile")
-
-keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")
-
-list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ")
-
-status = config.get("SEARCH", "Status", fallback="").split(", ")
-
-include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
-
-if include_no_prio:
-    list_of_columns += ["None"]
-
-select_all, select_where, create_db, insert_new = \
-    rcd.build_sql_commands(list_of_columns)
-
-save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file,
-                list_of_columns, create_db, insert_new, keywords, status)
--- a/examples/config.ini	Fri Nov 23 17:10:29 2018 +0100
+++ b/examples/config.ini	Mon Nov 26 16:08:27 2018 +0100
@@ -10,7 +10,7 @@
 
 [SEARCH]
 Search = prio
-Keywords = keywords1, keyword2, keyword3
+Keywords = keyword1, keyword2, keyword3
 Priority = critical, urgent, bug, feature, wish
-Status = unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved
+Status = unread, deferred, chatting, need-eg, in-progress, testing, done-cbb, resolved
 IncludeNoPrio = True
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)