-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, 7 Mar 2008 09:44:27 -0800 (PST)
meppum <[EMAIL PROTECTED]> wrote:
>
> I have also begun to run into this issue, and I agree with Kent here.
> If transaction management is set to the default (automatic) then
> failed saves should automatically
A simpler question - is there any reason *not* to include this code in
my model's save() method?
try:
Model.save(self)
except DatabaseError:
transaction.rollback_unless_managed()
raise
The benefits:
- automatic recovery from failed unmanaged transactions - very handy
when working
When accessing a Postgres database from Django ORM without any explicit
transaction management, any database query begins an implicit
transaction which ends with the next save().
If the save fails due to a database error (e.g. integrity violation,
timeout...) it raises an exception. At this po
3 matches
Mail list logo