ok, it is fixed :). No changes to tg code. Here is what my environment.py looks like. Kinda icky, but I kinda like it anyway :).
http://paste.turbogears.org/paste/3104 cheers. -chris On Jul 7, 5:29 pm, percious <[EMAIL PROTECTED]> wrote: > I am trying to get the newest TG2 to work with multiple databases. > The problem is that the database instantiation is tied up in > load_environment, and there is no way to modify it without modifying > how TG2 works. I thought this might be a nice solution, but I am > failing at it: > > from tg.environment import make_load_environment > from mbms.webapp.config.app_cfg import base_config > from sqlalchemy import engine_from_config > import mbms.webapp.lib.app_globals as app_globals > #from mbms.webapp.config.routing import make_map > from mbms.webapp.model import init_model, DBSession, metadata, > mbmsMetadata, mbmsDBSession, statusMetadata, statusDBSession, User, > Permission, Group > from pylons import config > > #Use base_config to setup the environment loader function > load_environment = make_load_environment(base_config) > > def make_extra_environment(base_config, le): > > def load_environment(global_conf, app_conf): > mbmsEngine = engine_from_config(base_config, > 'sqlalchemy_mbms.') > statusEngine = engine_from_config(base_config, > 'sqlalchemy_status.') > # Pass the engine to initmodel, to be able to introspect > tables > mbmsDBSession.configure(bind=mbmsEngine) > mbmsMetadata.bind = mbmsEngine > > statusDBSession.configure(bind=statusEngine) > statusMetadata.bind = mbmsEngine > > init_model(engine, mbmsEngine, statusEngine) > > return load_environment > > load_environment = make_extra_environment(base_config, > load_environment) > > help? > > -chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
