On 10/11/07, Rick Copeland <[EMAIL PROTECTED]> wrote: > > Hi, Hello,
> Apologies for missing the discussion on the decision to remove > implicit transactions and sessions from 1.1 (if there was one... I > can't find it in the archives). One of the things that I think makes Has you may have noticed in some previous posts, the decision to remove implicit transaction is not yet final and it may not even happen. > TG great is the existence of automatic transactions. I understand the > requirement to turn off transactions at the controller level (or the Hummm, I said in my above post that we should write some plugin that provides the transaction functionality, but outside the core. I don't necessarily want to remove transactions altogether but remove the transaction management from the core... > As for sessions, again, this seems like something that really belongs > in the framework, if we want to claim to "integrate" with an ORM. A > session is an absolute requirement for every controller that uses the > ORM layer of SA at all, so why not make it available? I know that SA > gives you the ability to work at the SQL layer (and thus not need a > session), but I know that, at least in my case, the vast majority of > controllers need one. Good question. The problem is that we may have controllers that don't need a db connection, this has been asked in the past. One important thing also is that we need to ensure a different scoped_session object is used in each thread. So this means that we have two choices: either leave database.py as a flat module and provide only a create_session function that you'll need to use as you described or change completely database to be a class and let the controller instanciate the db class once and then use db.session (session being a property) See example here: http://paste.turbogears.org/paste/1680 This would nearly emulate the code we are used to use today but make sure we provide a new scoped session to each thread. But you would still need to do some ------------------------------------------------------------------------- from tg.database import DataBase from myapp.model import MyObj class Root(controllers.RootController): database = DataBase() def index(self, *args, **kwargs): # get something from the db self.database.session.query(MyObj) ------------------------------------------------------------------------- Does it seem reasonable enough for you ? Florent. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
