kerinin schrieb: > I am completely confused, I've found multiple conflicting posts about > this, and my code seems to arbitrarily start throwing errors with no > cause. > > 1) Do I need to explicitly call session.begin() and session.close()? > I read in one place that importing turbogears.session makes these > calls unnesseccary (i.e. I can just use session.save(), session.commit > () and session.rollback(). This approach was working fine for a week > and now is completely broken. > > 2) If I use session.begin() and session.close(), how do I ensure that > the session being used to render pages is synchronized with the > database? I find that any time I create a new session, change an > object, commit it to the database and then close the session, the rest > of my app doesn't reflect the changes for a few minutes. > > 3) Is there anything I need to change from the quickstart to get this > working? I had to add elixir.setup_all() to the end of my model for > that to work - is there anything similar that needs to be setup to > make sessions work? > > Please please help, I'm completely lost and the whole app is starting > to implode with transaction errors.
The Session-stuff of SA/Elixir has bitten me countless times, as much as I like a lot of aspects of those two - it really is a major PITA. I'm not sure if I can help you, but this is what helps me debug this stuff: - ramp up the SQL-logging-level of the engine so you see what's being issued. Pay especially attention to begin/commit/rollback, and also especially when modifying statements (inserts, updates, deletes) are part of the transaction. - make sure your elixir-models belong to the *same* session-object TG uses! If not, they may even inject SQL into the DB, but being part of an otherwise uncared session never get commited. Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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?hl=en -~----------~----~----~----~------~----~------~--~---

