Florent Aide schrieb: > On Fri, Sep 4, 2009 at 12:14 AM, Christoph Zwerschke<[email protected]> wrote: >> After having a second look I noticed that after some polishing (already >> done in r6633) this is not a real problem. >> >> The old Session.mapper is still available as turbogears.database.mapper >> as long as it's available in SA. So old projects will continue to work >> with SA < 0.6 (emitting a deprecation warning for SA >= 0.5.5). > >> So this is "configurable" via the "import mapper from ..." in model.py. > > Right. We just need to document the way to use it. I'll work on the > website issue and then we're good for a release. If some people not > afraid of svn could test it I would be glad.
Sorry, for the late contribution to the discussion. I had a look at the recipe in the SQLAlchemy wiki for emulating the old session-aware mapper and it seems to me, this could be easily integrated into turbogears.database. The problem with the code as it is now (r6633) is that it will break existing TG1 apps that rely on the old session-aware mapper behavior when it is finally removed from SA (but, as noted in my earlier mail, it is still present in SA 0.6beta1). I find the three main session-aware mapper features (the 'MappedClass.query' attribute, the 'MappedClass(attr1=value, attr2=value,...)' constructor and the automatic adding to the session of new instances) very convenient and I do not really understand, why this was dropped from SA and what the advantage of having to use session.query(cls) and session.add(instance) all the time is. So, I propose the following patch to turbogears.database. I have tested this with an app that makes heavy use of the session-aware mapper features and encountered no problems so far. http://trac.turbogears.org/ticket/2359 Additionally, we could add a deprecation warning, when the emulated session-aware mapper is used. Also, should we document somewhere how to suppress this warning and the SADeprecationWarning when Session.mapper is used? 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 -~----------~----~----~----~------~----~------~--~---
