1
0
Fork 0

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
This commit is contained in:
Jan Dittberner 2009-08-02 20:51:24 +02:00
parent 06e1e11a61
commit 33696436a0
6 changed files with 50 additions and 16 deletions

14
bin/gva
View file

@ -21,20 +21,8 @@
# #
# Version: $Id$ # Version: $Id$
from paste.deploy import appconfig
from sys import argv from sys import argv
from os import getcwd from gnuviechadmin.config import config
from os.path import isfile
from logging.config import fileConfig
from gnuviechadmin.cli import CommandLineInterface 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() CommandLineInterface(config, argv).run()

View file

@ -1,6 +1,10 @@
from sqlalchemy import * from sqlalchemy import *
from migrate 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) meta = MetaData(migrate_engine)
client = Table( client = Table(

View file

@ -1,6 +1,10 @@
from sqlalchemy import * from sqlalchemy import *
from migrate 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) meta = MetaData(migrate_engine)
domain = Table('domain', meta, schema = dbschema, autoload = True) domain = Table('domain', meta, schema = dbschema, autoload = True)

View file

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

View file

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

37
gnuviechadmin/config.py Normal file
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)