sean@0: #!/usr/bin/env python sean@0: sean@0: """ supplys the data needed to comunicate with the roundup-server, sean@0: and the sqlite database. Represents the types of errors used in roundup. sean@0: sean@0: author: Sascha L. Teichmann sean@0: author: Bernhard Reiter sean@0: author: Sean Engelhardt sean@0: sean@0: (c) 2010,2015 by Intevation GmbH sean@0: sean@0: This is Free Software unter the terms of the sean@0: GNU GENERAL PUBLIC LICENSE Version 3 or later. sean@0: See http://www.gnu.org/licenses/gpl-3.0.txt for details sean@0: """ sean@0: sean@0: import os sean@0: sean@0: #rather use a real database for productiv use. sean@0: #this database NEEDS to chmod "777" or "666", wich is a major security issue sean@0: DATABASE_FILE = os.path.dirname(os.path.realpath(__file__)) + "/test.db" sean@0: sean@0: COLUMNS = [ sean@0: "critical", "urgent", "bug", "feature", "wish", sean@0: ] sean@0: sean@0: sean@0: # types of errors sean@0: CRITICAL = 1 sean@0: URGENT = 2 sean@0: BUG = 3 sean@0: FEATURE = 4 sean@0: WISH = 5 sean@0: sean@0: sean@0: data_dict = { sean@0: "date": [], sean@0: "critical": [], sean@0: "urgent": [], sean@0: "bug": [], sean@0: "feature": [], sean@0: "wish": [] sean@0: } sean@0: sean@0: sean@0: #SQL sean@0: SELECT_ALL = """ sean@0: SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp), sean@0: critical, sean@0: urgent, sean@0: bug, sean@0: feature, sean@0: wish sean@0: FROM issues sean@0: ORDER BY timestamp sean@0: """ sean@0: sean@0: sean@0: CREATE_DB = """ sean@0: CREATE TABLE issues ( sean@0: timestamp TIMESTAMP NOT NULL UNIQUE DEFAULT current_timestamp, sean@0: critical INTEGER NOT NULL DEFAULT 0, sean@0: urgent INTEGER NOT NULL DEFAULT 0, sean@0: bug INTEGER NOT NULL DEFAULT 0, sean@0: feature INTEGER NOT NULL DEFAULT 0, sean@0: wish INTEGER NOT NULL DEFAULT 0 sean@0: ) sean@0: """ sean@0: sean@0: sean@0: INSERT_NEW = """ sean@0: INSERT INTO issues (critical, urgent, bug, feature, wish) sean@0: VALUES (?, ?, ?, ?, ?) sean@0: """