-----Ursprüngliche Nachricht----- Von: "Niklas Hambüchen" <[email protected]> Gesendet: 03.01.2011 22:03:55 An: [email protected] Betreff: Re: [TurboGears] Why is DBSession.flush() needed for relations?
>What I still don't get is why _my_ flush changes the result. The >structure of my controller is: > >a = Article() >sometopic.articles.append(a) >DBSession.add(a) >DBSession.flush() >[end of controller] > >As far as I understand, Turbogears automatically flushes and commits >with its transaction manager. Why does my additional flush just before >the automatic flush change the result? Does it really do that? Or are you getting confused by trying to display it yielding a None-value? Because at template-rendering-time, the flushing hasn't taken place, and as a result you get None for an id. Also, I don't understand the DBSession.add above. It shouldn't be needed in Elixir (one of the reasons we use it as well, as it gets you closer to the "I'm working with objects" paradigm) I have to admit though that occasionally, I had to sprinkle the code with flushs for no apparent reason. There might be a deeper reason for that (recently, I found that one really should use *entities*, never the implicit entity_id-column), but that doesn't explain all oddities. If you can, try & make the above code into a self-contained example & ask on the elixir ML. Gaetan is pretty responsive. Diez ___________________________________________________________ Empfehlen Sie WEB.DE DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.web.de -- 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.

