Don't you need to explictly use a transaction in this case? The example in
the documentation for the 3.0 tutorial has something similar to this :
transaction = session.create_transaction()
try:
blah...
session.flush()
blah...
transaction.commit()
except:
transaction.rollback()
raise
HTH
Nicky
--
On 12/14/06, Sanjay <[EMAIL PROTECTED]> wrote:
>
>
> > You should also clear the session so the pending object is not
> > flushed by run_with_transaction.
>
> Did you mean, if I write some code as below, it should rollback
> properly all the flushed data?
>
> @expose(...)
> def foo(self, tg_exceptions=None)
> if tg_exceptions:
> flush("Failed. All changes should have been rolled back")
> session.clear() # as you suggested
> .
> .
> .
>
> @expose()
> @exception_handler(foo)
> def foo_save(self, **data):
> .
> save_data_part1(...)
> session.flush()
> call_a_method_which_might_raise_an_exception()
> save_data_part2(...)
> .
> .
>
> But as I observed, the data_part1 is getting saved even if an exception
> is raised afterwards.
>
> thanks
> sanjay
>
>
> >
>
--
--
Nicky Ayoub
G-Mail Account
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---