The only log entries I want committed are the ones that tell me why a roll-back occurred. What you've said below sounds like a good enough solution, thanks for all your input.
Cheers, Chris On Mon, Jun 8, 2009 at 11:38 PM, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, Jun 8, 2009 at 5:39 AM, Chris Stoyles <cstoy...@gmail.com> wrote: > >> 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. >> > > Sounds like the easiest thing to do would be to accumulate (but not call > save() on) LogEntry objects as you do the work, then at the end either after > you have either rolled back the main work or are about to commit it, save() > whatever LogEntry objects you have accumulated. (I'd probably also want to > indicate in the entries associated with work that was ultimately rolled back > that that happened, otherwise it seems the log might be a bit confusing, > containing entries for stuff that ultimately got rolled back...but maybe > that's not an issue for the log you are keeping?) > > Karen > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---