Mercurial > roundup-cc
comparison roundup_content_data/__init__.py @ 0:3f139db894f1
initial commit
author | sean |
---|---|
date | Thu, 02 Apr 2015 09:51:19 +0200 |
parents | |
children | 2df45f6ecd81 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3f139db894f1 |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 """ supplys the data needed to comunicate with the roundup-server, | |
4 and the sqlite database. Represents the types of errors used in roundup. | |
5 | |
6 author: Sascha L. Teichmann <sascha.teichmann@intevation.de> | |
7 author: Bernhard Reiter <bernhard@intevation.de> | |
8 author: Sean Engelhardt <sean.engelhardt@intevation.de> | |
9 | |
10 (c) 2010,2015 by Intevation GmbH | |
11 | |
12 This is Free Software unter the terms of the | |
13 GNU GENERAL PUBLIC LICENSE Version 3 or later. | |
14 See http://www.gnu.org/licenses/gpl-3.0.txt for details | |
15 """ | |
16 | |
17 import os | |
18 | |
19 #rather use a real database for productiv use. | |
20 #this database NEEDS to chmod "777" or "666", wich is a major security issue | |
21 DATABASE_FILE = os.path.dirname(os.path.realpath(__file__)) + "/test.db" | |
22 | |
23 COLUMNS = [ | |
24 "critical", "urgent", "bug", "feature", "wish", | |
25 ] | |
26 | |
27 | |
28 # types of errors | |
29 CRITICAL = 1 | |
30 URGENT = 2 | |
31 BUG = 3 | |
32 FEATURE = 4 | |
33 WISH = 5 | |
34 | |
35 | |
36 data_dict = { | |
37 "date": [], | |
38 "critical": [], | |
39 "urgent": [], | |
40 "bug": [], | |
41 "feature": [], | |
42 "wish": [] | |
43 } | |
44 | |
45 | |
46 #SQL | |
47 SELECT_ALL = """ | |
48 SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp), | |
49 critical, | |
50 urgent, | |
51 bug, | |
52 feature, | |
53 wish | |
54 FROM issues | |
55 ORDER BY timestamp | |
56 """ | |
57 | |
58 | |
59 CREATE_DB = """ | |
60 CREATE TABLE issues ( | |
61 timestamp TIMESTAMP NOT NULL UNIQUE DEFAULT current_timestamp, | |
62 critical INTEGER NOT NULL DEFAULT 0, | |
63 urgent INTEGER NOT NULL DEFAULT 0, | |
64 bug INTEGER NOT NULL DEFAULT 0, | |
65 feature INTEGER NOT NULL DEFAULT 0, | |
66 wish INTEGER NOT NULL DEFAULT 0 | |
67 ) | |
68 """ | |
69 | |
70 | |
71 INSERT_NEW = """ | |
72 INSERT INTO issues (critical, urgent, bug, feature, wish) | |
73 VALUES (?, ?, ?, ?, ?) | |
74 """ |