Split the database config into 2 sections
This commit is contained in:
parent
74fd937732
commit
88322fffae
@ -1,7 +1,7 @@
|
||||
from configparser import ConfigParser
|
||||
|
||||
|
||||
def config(filename="database.ini", section="postgresql"):
|
||||
def config(filename="database.ini", section="production"):
|
||||
# create a parser
|
||||
parser = ConfigParser()
|
||||
# read config file
|
||||
|
@ -1,4 +1,7 @@
|
||||
# For local users you can simply rely on the UNIX permissions.
|
||||
# For remote databases you have to add host, user and password
|
||||
[postgresql]
|
||||
[production]
|
||||
database=imported_git
|
||||
|
||||
[test]
|
||||
database=imported_git_test
|
||||
|
10
db.py
10
db.py
@ -52,8 +52,14 @@ class DB:
|
||||
""",
|
||||
"INSERT INTO scheme (version) VALUES(1)",
|
||||
""" CREATE TABLE revisions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
package VARCHAR(255) NOT NULL
|
||||
id SERIAL PRIMARY KEY,
|
||||
project VARCHAR(255) NOT NULL,
|
||||
package VARCHAR(255) NOT NULL,
|
||||
rev VARCHAR(255) NOT NULL,
|
||||
unexpanded_srcmd5 VARCHAR(255) NOT NULL,
|
||||
commit_time timestamp NOT NULL,
|
||||
userid VARCHAR(255) NOT NULL,
|
||||
comment VARCHAR(255)
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
@ -19,7 +19,6 @@ class Revision:
|
||||
self.rev = int(xml.get("rev"))
|
||||
# Replaced in check_expanded
|
||||
self.srcmd5 = xml.find("srcmd5").text
|
||||
self.version = xml.find("version").text
|
||||
|
||||
time = int(xml.find("time").text)
|
||||
self.time = datetime.datetime.fromtimestamp(time)
|
||||
|
Loading…
Reference in New Issue
Block a user