Skip to content

Commit

Permalink
Added config module to handle app.ini parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mgilligan committed Jul 26, 2013
1 parent d368399 commit a0eaec3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions app.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[DEFAULT]
SRID = 4326

[loggers]
keys = root

Expand Down
10 changes: 1 addition & 9 deletions gtfsdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import logging.config
import os
from pkg_resources import get_distribution

from gtfsdb.config import config
from gtfsdb.model.agency import Agency
from gtfsdb.model.calendar import Calendar, CalendarDate, UniversalCalendar
from gtfsdb.model.db import Database
Expand All @@ -15,8 +12,3 @@
from gtfsdb.model.stop_time import StopTime
from gtfsdb.model.transfer import Transfer
from gtfsdb.model.trip import Trip


logging.config.fileConfig(
os.path.join(get_distribution('gtfsdb').location, 'app.ini'),
disable_existing_loggers=False)
11 changes: 11 additions & 0 deletions gtfsdb/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from ConfigParser import ConfigParser
import logging.config
import os
from pkg_resources import get_distribution


ini_file = os.path.join(get_distribution('gtfsdb').location, 'app.ini')
config = ConfigParser()
config.read(ini_file)
if config.has_section('loggers'):
logging.config.fileConfig(ini_file, disable_existing_loggers=False)

0 comments on commit a0eaec3

Please sign in to comment.