Hi Thomas,

The reason I want to be able to rollback (but still commit by log entries)
is because it is sometimes valid for this particular view to throw an
exception and fail. If this happens, I need to rollback any model objects
that have been created and saved up to the point at which the view fails
(again, except for any logging that has been done). The view contains a big
try/except statement and the rollback is in the "except" part.

I may have to approach this a different way, because it doesn't look like I
can easily do a fine-grained commit.

Cheers,
Chris

On Mon, Jun 8, 2009 at 3:14 PM, Thomas Guettler <h...@tbz-pariv.de> wrote:

>
> Hi Chris,
>
> please explain in more depth what you want to do. If you
> do rollback, all changes won't be written to the database. Even
> all savepoints won't be stored.
>
> Why do you want to rollback? If you want your changes
> to get saved, you need to call transaction.commit() at the end.
>
> ChrisStoyles schrieb:
> > Hi All,
> >
> > I just wanted to quickly reach out to the group for ideas as to why I
> > cannot get this to work:
> >
> > @transaction.commit_manually
> > def some_view(request):
> >     # some view logic goes here
> >
> >     sid = transaction.savepoint()
> >     le = models.LogEntry()
> >     le.message = 'A test log message'
> >     le.save()
> >     transaction.savepoint_commit(sid)
> >
> >     transaction.rollback()
> >
> > My database back end is Postgres 8.3 and the engine I am using is
> > postgresql_psycopg2. Any ideas as to why my LogEntry would not be
> > committed to the database? I am not getting any exceptions being
> > raised, the code executes as though it has all worked perfectly.
>
>
> --
> Thomas Guettler, http://www.thomas-guettler.de/
> E-Mail <http://www.thomas-guettler.de/%0AE-Mail>: guettli (*)
> thomas-guettler + de
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to