Mercurial > roundup-cc
annotate collect_issues.py @ 15:d0c439d1e833
Prepare for tracker entries without priority.
* Extend issues_to_quantities to count entries with priority 'None'.
The regular classic template enforces a priority value, but some
trackers don't, e.g. the 'fast-decomposed' variant used by Intevation
(https://hg.intevation.de/roundup/fast-decomposed/) uses other fields
for a scrum like workflow that show the order of issues as a float value.
In order to get all issues, we also have to collect them.
Implement it in a backwards compatible manner for
save_stats_in_db() by a keyword argument that is off by default.
This is just a preparation as the database must also accept an additional
column.
* Cleanup some superfluous whitespace, remove an unused import
and add copyright 208 year.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 06 Jul 2018 17:36:21 +0200 |
parents | e95f7bee8643 |
children | adca5b3780d2 |
rev | line source |
---|---|
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
2 """ Fetch issues from a roundup-tracker and save them in a databse. |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
3 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
4 author: Sascha L. Teichmann <sascha.teichmann@intevation.de> |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
5 author: Bernhard Reiter <bernhard@intevation.de> |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
6 author: Sean Engelhardt <sean.engelhardt@intevation.de> |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
7 |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
8 (c) 2010, 2015, 2018 by Intevation GmbH |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
9 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
10 This is Free Software unter the terms of the |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
11 GNU GENERAL PUBLIC LICENSE Version 3 or later. |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
12 See http://www.gnu.org/licenses/gpl-3.0.txt for details |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
13 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
14 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
15 ##USAGE EXAMPLE: ## |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
16 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
17 BASE_URL_DEMO = "http://localhost:8917/demo/" |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
18 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" |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
19 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
20 LOGIN_PARAMETERS_DEMO = ( |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
21 ("__login_name", "demo"), |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
22 ("__login_password", "demo"), |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
23 ("@action", "Login"), |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
24 ) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
25 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
26 save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, rcd.DATABASE_DEMO, rcd.COLUMNS, rcd.CREATE_DB, rcd.INSERT_NEW, SEARCH_URL_DEMO) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
27 """ |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
28 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
29 import http.cookiejar |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
30 import urllib.parse |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
31 import urllib.request |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
32 import csv |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
33 import io |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
34 import sqlite3 as db |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
35 import os |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
36 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
37 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
38 CHECK_ROUNDUP_ORDER = "priority?@action=export_csv&@columns=id,order" |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
39 CHECK_ROUNDUP_SEARCH_VALUES = "status?@action=export_csv&@columns=id&@filter=open&open=1" |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
40 SEARCH_ROUNDUP = "issue?@action=export_csv&@columns=priority&@filter=status&@pagesize=500&@startwith=0&status=-1,{search_values}" |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
41 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
42 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
43 def connect_to_server(params, baseurl): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
44 enc_data = urllib.parse.urlencode(params).encode() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
45 cj = http.cookiejar.CookieJar() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
46 opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
47 req = urllib.request.Request(url=baseurl, data=enc_data) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
48 opener.open(req) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
49 return opener |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
50 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
51 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
52 def get_csv_from_server(opener, roundup_url, sub_url): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
53 csv_req = urllib.request.Request(url=roundup_url+sub_url) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
54 f = opener.open(csv_req) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
55 csv_reader = csv.DictReader(io.TextIOWrapper(f)) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
56 return csv_reader |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
57 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
58 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
59 def set_search_paramters_on_URL(url, search_param_csv): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
60 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
61 id_list = [] |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
62 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
63 for row in search_param_csv: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
64 id_list.append(row["id"]) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
65 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
66 new_url = url.format(search_values = ",".join(id_list)) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
67 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
68 return new_url |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
69 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
70 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
71 def check_create_database(database_file, sql_create_db): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
72 if not os.path.isfile(database_file): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
73 con = None |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
74 cur = None |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
75 try: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
76 con = db.connect(database_file) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
77 cur = con.cursor() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
78 try: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
79 cur.execute(sql_create_db) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
80 con.commit() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
81 os.chmod(database_file, 0o644) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
82 except: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
83 con.rollback() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
84 raise |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
85 finally: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
86 if cur: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
87 cur.close() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
88 if con: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
89 con.close() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
90 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
91 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
92 def issues_to_quantities(issue_csv, columns, orders_csv): |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
93 """Count issues per priority. |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
94 |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
95 Returns: a list of ints, containing how often a prio occurred [:-1] |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
96 in order of the priorities, with the last being the "None" prio |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
97 """ |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
98 |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
99 quantities = [0] * (len(columns) +1) |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
100 order_dict = {} |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
101 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
102 #convert the csv-dict reader to real dict |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
103 for row in orders_csv: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
104 order_dict[row["id"]] = int(float(row["order"])) # int(float()) because the order-value is indeed "1.0, 2.0" etc |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
105 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
106 for issue in issue_csv: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
107 priority = issue["priority"] |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
108 |
2 | 109 if priority.isdigit() == True : |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
110 quantities[order_dict[priority] -1 ] += 1 |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
111 else: # no priority set |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
112 quantities[-1] += 1 |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
113 |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
114 # print("quantities : " + str(quantities)) |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
115 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
116 return quantities |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
117 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
118 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
119 def save_issues_to_db(quantities, database_file, sql_create_db, sql_insert_in_db): |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
120 check_create_database(database_file, sql_create_db) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
121 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
122 cur = None |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
123 con = None |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
124 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
125 try: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
126 con = db.connect(database_file) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
127 cur = con.cursor() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
128 try: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
129 cur.execute(sql_insert_in_db, quantities) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
130 con.commit() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
131 except: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
132 con.rollback() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
133 raise |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
134 finally: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
135 if cur: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
136 cur.close() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
137 if con: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
138 con.close() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
139 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
140 |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
141 def save_stats_in_db(login_parmeters, baseurl, db_file, columns, sql_create_db, sql_insert_in_db, searchurl=False, include_no_prio=False): |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
142 try: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
143 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
144 opener = connect_to_server(login_parmeters, baseurl) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
145 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
146 search_operators_csv = get_csv_from_server(opener, baseurl, CHECK_ROUNDUP_SEARCH_VALUES) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
147 order_csv = get_csv_from_server(opener, baseurl, CHECK_ROUNDUP_ORDER) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
148 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
149 if searchurl == False: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
150 formated_search_url = set_search_paramters_on_URL(SEARCH_ROUNDUP, search_operators_csv) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
151 else: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
152 formated_search_url = searchurl |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
153 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
154 current_issues_csv = get_csv_from_server(opener, baseurl, formated_search_url) |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
155 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
156 opener.close() |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
157 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
158 quantities = issues_to_quantities(current_issues_csv, columns, order_csv) |
15
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
159 if not include_no_prio: |
d0c439d1e833
Prepare for tracker entries without priority.
Bernhard Reiter <bernhard@intevation.de>
parents:
9
diff
changeset
|
160 quantities = quantities[:-1] |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
161 |
9 | 162 save_issues_to_db(quantities, db_file, sql_create_db, sql_insert_in_db) |
1
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
163 |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
164 except urllib.error.URLError as e: |
2df45f6ecd81
new appereance (solid and dotted lines), resonsive layout, new legend,
sean
parents:
diff
changeset
|
165 print("No Valid Connection to server : " + baseurl + "\nerror: " + str(e)) |