view roundup_content_data/__init__.py @ 0:3f139db894f1

initial commit
author sean
date Thu, 02 Apr 2015 09:51:19 +0200
parents
children 2df45f6ecd81
line wrap: on
line source
#!/usr/bin/env python

""" supplys the data needed to comunicate with the roundup-server,
and the sqlite database. Represents the types of errors used in roundup.

author: Sascha L. Teichmann <sascha.teichmann@intevation.de>
author: Bernhard Reiter <bernhard@intevation.de>
author: Sean Engelhardt <sean.engelhardt@intevation.de>

(c) 2010,2015 by Intevation GmbH

This is Free Software unter the terms of the
GNU GENERAL PUBLIC LICENSE Version 3 or later.
See http://www.gnu.org/licenses/gpl-3.0.txt for details
"""

import os

#rather use a real database for productiv use.
#this database NEEDS to chmod "777" or "666", wich is a major security issue
DATABASE_FILE = os.path.dirname(os.path.realpath(__file__)) + "/test.db"

COLUMNS = [
    "critical", "urgent", "bug", "feature", "wish",
]


# types of errors
CRITICAL = 1
URGENT = 2
BUG = 3
FEATURE = 4
WISH = 5


data_dict = {
    "date": [],
    "critical": [],
    "urgent": [],
    "bug": [],
    "feature": [],
    "wish": []
}


#SQL
SELECT_ALL = """
SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp),
    critical,
    urgent,
    bug,
    feature,
    wish
FROM issues
ORDER BY timestamp
"""


CREATE_DB = """
CREATE TABLE issues (
    timestamp TIMESTAMP NOT NULL UNIQUE DEFAULT current_timestamp,
    critical INTEGER NOT NULL DEFAULT 0,
    urgent INTEGER NOT NULL DEFAULT 0,
    bug INTEGER NOT NULL DEFAULT 0,
    feature INTEGER NOT NULL DEFAULT 0,
    wish INTEGER NOT NULL DEFAULT 0
)
"""


INSERT_NEW = """
    INSERT INTO issues (critical, urgent, bug, feature, wish)
    VALUES (?, ?, ?, ?, ?)
"""
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)