Browse Source

move config initialisation to gnuviechadmin.config

* data/dbrepo/versions/002.py use gnuviechadmin.config to read config
   (fixes #37)
 * move config initialization out of bin/gva to make it usable elsewhere
 * add config.py to egg-info
master
Jan Dittberner 11 years ago
parent
commit
33696436a0
6 changed files with 50 additions and 16 deletions
  1. +1
    -13
      bin/gva
  2. +5
    -1
      data/dbrepo/versions/002.py
  3. +5
    -1
      data/dbrepo/versions/003.py
  4. +1
    -1
      gnuviechadmin.egg-info/PKG-INFO
  5. +1
    -0
      gnuviechadmin.egg-info/SOURCES.txt
  6. +37
    -0
      gnuviechadmin/config.py

+ 1
- 13
bin/gva View File

@@ -21,20 +21,8 @@
#
# Version: $Id$

from paste.deploy import appconfig
from sys import argv
from os import getcwd
from os.path import isfile
from logging.config import fileConfig
from gnuviechadmin.config import config
from gnuviechadmin.cli import CommandLineInterface

if len(argv) > 1 and isfile(argv[1]):
configfile = argv[1]
del argv[1]
else:
configfile = 'development.ini'

config = appconfig('config:%s' % configfile, relative_to=getcwd())
fileConfig(configfile, config)

CommandLineInterface(config, argv).run()

+ 5
- 1
data/dbrepo/versions/002.py View File

@@ -1,6 +1,10 @@
from sqlalchemy import *
from migrate import *
from gnuviechadmin.backend.settings import dbschema
from gnuviechadmin.config import config

dbschema = None
if 'database.schema' in config:
dbschema = config['database.schema']

meta = MetaData(migrate_engine)
client = Table(


+ 5
- 1
data/dbrepo/versions/003.py View File

@@ -1,6 +1,10 @@
from sqlalchemy import *
from migrate import *
from gnuviechadmin.backend.settings import dbschema
from gnuviechadmin.config import config

dbschema = None
if 'database.schema' in config:
dbschema = config['database.schema']

meta = MetaData(migrate_engine)
domain = Table('domain', meta, schema = dbschema, autoload = True)


+ 1
- 1
gnuviechadmin.egg-info/PKG-INFO View File

@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: gnuviechadmin
Version: 0.1.dev-20090730
Version: 0.1.dev-20090802
Summary: gnuviechadmin server administration suite
Home-page: http://www.gnuviech-server.de/projects/gnuviechadmin
Author: Jan Dittberner


+ 1
- 0
gnuviechadmin.egg-info/SOURCES.txt View File

@@ -3,6 +3,7 @@ setup.py
bin/gva
bin/gvaserver
gnuviechadmin/__init__.py
gnuviechadmin/config.py
gnuviechadmin/exceptions.py
gnuviechadmin.egg-info/PKG-INFO
gnuviechadmin.egg-info/SOURCES.txt


+ 37
- 0
gnuviechadmin/config.py View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 by Jan Dittberner.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# Version: $Id$

from sys import argv
from os import getcwd
from os.path import isfile
from paste.deploy import appconfig
from logging.config import fileConfig

if len(argv) > 1 and isfile(argv[1]):
configfile = argv[1]
del argv[1]
else:
configfile = 'development.ini'

config = appconfig('config:%s' % configfile, relative_to=getcwd())
fileConfig(configfile, config)

Loading…
Cancel
Save