Well, it looks like configure is a class method on Session, so when you do
session.configure() you are configuring future sessions, not the current
one.

The extensions for a session instance are are a property named extensions.
You could try setting that list yourself.

session.extensions = [MySessionExtension()]

to replace the existing extension or

session.extensions.append(MySessionExtension())

to add yours to the list

But understand the risk that this is modifying internals and might not work,
and no guarantee it will work in future versions.

-- 
Mike Conley



On Thu, Sep 10, 2009 at 4:29 AM, asrenzo <laurent.rah...@gmail.com> wrote:

>
> I also tried session.configure(extension=MySessionExtension()) with no
> success
>
>
> On 10 sep, 10:13, Laurent Rahuel <laurent.rah...@gmail.com> wrote:
> > Hi,
> >
> > I'm currently using a webframework which uses sqlalchemy. Each time a
> > request hits the server, the framework creates a session object I can
> > use during the page creation.
> >
> > I wish you could update this session with one of my SessionExtension but
> > I'm facing a small problem:
> >
> > I tested my code with a standalone session I had created with this
> > syntax : session = create_session(extension=MySessionExtension()) and
> > everything works. When I try the same code in my web context and I do:
> >
> > """""""""""""""""
> > from framework.db import session
> >
> > session.extension = MySessionExtension()
> >
> > .
> > .
> > .
> >
> > """""""""""""""
> >
> > None of my extension session methods are called.
> >
> > Any idea ?
> >
>

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

Reply via email to