# HG changeset patch # User Bernhard Reiter # Date 1448956955 -3600 # Node ID 99e2e0e17103b7050eb700ee3ee914db01947ea2 # Parent a1e71b5e4d68628100fbdc8177a03a3ee31ba544 Adding possibility and example to filter the entries. diff -r a1e71b5e4d68 -r 99e2e0e17103 display_issues.py --- a/display_issues.py Tue Dec 01 09:01:52 2015 +0100 +++ b/display_issues.py Tue Dec 01 09:02:35 2015 +0100 @@ -14,12 +14,7 @@ ##Usage Example: ## - -from display_issues import * -cgitb.enable() # (optional) HTML traceback to browser -print("Content-Type: text/html") -print() -render_db_stats_as_html(rcd.DATABASE_DEMO, rcd.SELECT_ALL) +see display_issues_demo.py or __main__ section below. """ import sqlite3 as db @@ -94,7 +89,8 @@ if __name__ == '__main__': cgitb.enable() - print("Content-Type: text/html") - print() + #spit out HTML file directly, thus no need to give headers to the server + #print("Content-Type: text/html") + #print() render_db_stats_as_html(rcd.DATABASE_DEMO, rcd.SELECT_ALL) diff -r a1e71b5e4d68 -r 99e2e0e17103 display_issues_demo.py --- a/display_issues_demo.py Tue Dec 01 09:01:52 2015 +0100 +++ b/display_issues_demo.py Tue Dec 01 09:02:35 2015 +0100 @@ -18,4 +18,6 @@ cgitb.enable() # (optional) HTML traceback to browser print("Content-Type: text/html") print() -render_db_stats_as_html(rcd.DATABASE_DEMO, rcd.SELECT_ALL) +#render_db_stats_as_html(rcd.DATABASE_DEMO, rcd.SELECT_ALL) +render_db_stats_as_html(rcd.DATABASE_DEMO, + rcd.SELECT_WHERE.format("timestamp > date('now', '-2 month')")) diff -r a1e71b5e4d68 -r 99e2e0e17103 roundup_content_data/__init__.py --- a/roundup_content_data/__init__.py Tue Dec 01 09:01:52 2015 +0100 +++ b/roundup_content_data/__init__.py Tue Dec 01 09:02:35 2015 +0100 @@ -50,6 +50,18 @@ ORDER BY timestamp """ +SELECT_WHERE = """ +SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp), + critical, + urgent, + bug, + feature, + wish +FROM issues +WHERE {} +ORDER BY timestamp +""" + CREATE_DB = """ CREATE TABLE issues ( @@ -79,4 +91,4 @@ wishlist FROM issues ORDER BY sample_time -""" \ No newline at end of file +"""