On 9/21/07, renier <[EMAIL PROTECTED]> wrote:

> > > --- TurboGears-1.0.3.2dev_r3487-py2.5.egg/turbogears/
> > > database.py.orig   2007-09-10 16:43:39.000000000 -0400
> > > +++ TurboGears-1.0.3.2dev_r3487-py2.5.egg/turbogears/
> > > database.py        2007-09-10 16:45:37.000000000 -0400
> > > @@ -27,7 +27,7 @@
> > >  # Provide support for sqlalchemy
> > >  try:
> > >      import sqlalchemy
> > > -    from sqlalchemy.ext import activemapper, sessioncontext
> > > +    import elixir
> > >      from sqlalchemy.exceptions import InvalidRequestError
> >
> > >      def get_engine():
> > > @@ -58,9 +58,8 @@
> >
> > >          return sqlalchemy.orm.create_session()
> >
> > > -    metadata = activemapper.metadata
> > > -    session = activemapper.Objectstore(create_session)
> > > -    activemapper.objectstore = session
> > > +    metadata = elixir.metadata
> > > +    session = elixir.objectstore
> >
> > >      def bind_meta_data():
> > >          get_engine()
> >
> > I guess you can't just replace ActiveMapper with Elixir, as people
> > still using ActiveMapper would complain. If you go down that route
> > anyway, you could simplify the database.py further as with the latest
> > versions of Elixir (>= 0.3), you don't need to connect the metadata in
> > each thread.
>
> Do you mean that I don't need to set metadata or session in TG's
> database.py?

No. I mean, that you could probably (I haven't actually tried it) use
a vanilla create_session in TG's database.py instead of the one they
provide because, as far as I can tell, they had to provide one for the
sole purpose of reconnecting the metadata to the engine in each
thread. And this could now be done globally as simply metadata.bind =
...

> I think, whether TG internally uses activemapper or Elixir to wrap
> around sqlalchemy shouldn't concern the end user. The problem with
> database.py importing activemapper is that it will create an
> objectstore without wrapping SessionContext or ScopedSession around
> create_session. I'm not sure if this is significant. You tell me.

The only problem with that is that there was an isinstance(...,
Objectstore) check somewhere which failed because it really meant:
isinstance(..., Objectstore) and didn't work with the activemapper's
Objectstore wrapper. Now I've made the test more liberal and it should
accept ActiveMapper's objectstore. So it means that TurboGears should
now work again with the latest version of Elixir, even with no fix on
their side. But please, PLEASE, try to get them to fix the issue
anyway (ie provide a proper Elixir integration), because it'll bomb
again if we ever change the objectstore definition again.

-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to