save point (see note)

Added initial database schema and ability to install it, added init-db command
to pyramid scaffold.
This commit is contained in:
Lance Edgar 2012-03-24 12:15:11 -05:00
parent 925cd30b96
commit 8ceb98baf4
29 changed files with 1116 additions and 191 deletions

View file

@ -27,13 +27,14 @@
"""
import os
# import locale
import logging
from edbob.configuration import AppConfigParser
from edbob.configuration import default_system_paths, default_user_paths
from edbob.core import graft
from edbob.times import set_timezone
import edbob
from edbob.configuration import (
AppConfigParser,
default_system_paths,
default_user_paths,
)
__all__ = ['init']
@ -83,19 +84,15 @@ def init(appname='edbob', *args, **kwargs):
config.read(paths, recurse=not shell)
config.configure_logging()
# loc = config.get('edbob', 'locale')
# if loc:
# locale.setlocale(locale.LC_ALL, loc)
# log.info("Set locale to '%s'" % loc)
default_modules = 'edbob.time'
modules = config.get('edbob', 'init', default=default_modules)
if modules:
for name in modules.split(','):
name = name.strip()
module = __import__(name, globals(), locals(), fromlist=['init'])
getattr(module, 'init')(config)
# config.inited.append(name)
tz = config.get('edbob', 'timezone')
if tz:
set_timezone(tz)
log.info("Set timezone to '%s'" % tz)
else:
log.warning("No timezone configured; falling back to US/Central")
set_timezone('US/Central')
import edbob
graft(edbob, locals(), 'config')
# config.inited.append('edbob')
edbob.graft(edbob, locals(), 'config')
edbob.inited = True