You'll want to setup another session_context similar to how the main
one is setup in pylons.database.

For example, in one of your models modules:

from paste.deploy import CONFIG
from sqlalchemy.ext import sessioncontext
from pylons.database import app_scope, make_session

dburi2 = CONFIG['app_conf']['sqlachemy.dburi2']
session_context2 = sessioncontext.SessionContext(lambda: make_session
(dburi2), scopefunc=app_scope)

It works, at least if I verify with "paster shell".

But I tried to write a simple test to assert this behavior and got a
strange error:

 File
"/home/max/projects/dou-trunk/site/doupy/doupy/tests/functional/test_db_conn.py",
line 2, in ?
   from doupy.lib.database import *
 File "/home/max/projects/dou-trunk/site/doupy/doupy/lib/database.py",
line 15, in ?
   dburi = CONFIG['app_conf']['sqlalchemy.dburi']
 File
"/usr/lib/python2.4/site-packages/PasteDeploy-1.0-py2.4.egg/paste/deploy/config.py",
line 119, in __getitem__
   raise TypeError(
TypeError: No configuration has been registered for this process or
thread


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to