Hi
> There is a follow up somewhere on this list (sorry, too lazy to track
> it down) that notes that Elixir has its own session context, and as
> far as I can tell, you have to use that one instead of creating one
> through pylons.database. Instead of:
>
> from pylons.database import session_context
>
> do this:
>
> import elixir
> session_context = elixir.objectstore.context
>
> There is probably a way to use a different session context, but this
> seems to work well enough for me for now (in production even).
>
> On a related note, you might be interested in this:
> http://code.google.com/p/restler/.
> If you scroll all the way down to the bottom of
> http://restler.googlecode.com/svn/trunk/restler/base.py to the
> `init_model` function, you can see an example setup. Note that even
> though it tries to get a `session_context` from the model before using
> Elixir's builtin one, for now I never create a `session_context` in
> my model, so I always end up using Elixir's.
>
> HTH,
>
> __wyatt
>
Thanks for these hints. I tried to apply your technik, just added
del model.session_context.current
in basecontroller.
I ended up with:
#base.py
class BaseController(WSGIController):
def __call__(self, environ, start_response):
del model.session_context.current
#models/__init__.py
from pylons.database import create_engine
from elixir import metadata, objectstore
engine = create_engine()
session_context = objectstore.context
def connect():
metadata.connect(engine)
connect()
#my classes
from pyoner.models.user import User
--
Best regards,
Antipin Aleksei
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---