annotate roundup_content_data/__init__.py @ 0:3f139db894f1

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