view pylons_app/model/__init__.py @ 473:6b934c9607e7 celery

Improved testing scenarios. Made test env creator Fixed hg_model error message some other tweeks and fixes Models fixe for uniq email, and removed some extra not needed imports from model main module
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 13 Sep 2010 01:23:58 +0200
parents 564e40829f80
children
line wrap: on
line source

"""The application's model objects"""
import logging
from pylons_app.model import meta
log = logging.getLogger(__name__)

def init_model(engine):
    """Call me before using any of the tables or classes in the model"""
    log.info("INITIALIZING DB MODELS")
    meta.Base.metadata.bind = engine
    #meta.Base2.metadata.bind = engine2

#THIS IS A TEST FOR EXECUTING SCRIPT AND LOAD PYLONS APPLICATION GLOBALS
#from paste.deploy import appconfig
#from pylons import config
#from sqlalchemy import engine_from_config
#from pylons_app.config.environment import load_environment
#
#conf = appconfig('config:development.ini', relative_to = './../../')
#load_environment(conf.global_conf, conf.local_conf)
#
#engine = engine_from_config(config, 'sqlalchemy.')
#init_model(engine)
# DO SOMETHING