mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[1.1.X] Fixed #12189 -- Corrected rollback behavior in database cache backend. Thanks to Lakin Wecker for the report.
Backport of r12409 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12413 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3792b2cd9f
commit
a9282168f5
2
django/core/cache/backends/db.py
vendored
2
django/core/cache/backends/db.py
vendored
@ -65,7 +65,7 @@ class CacheClass(BaseCache):
|
|||||||
cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)])
|
cursor.execute("INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)" % self._table, [key, encoded, str(exp)])
|
||||||
except DatabaseError:
|
except DatabaseError:
|
||||||
# To be threadsafe, updates/inserts are allowed to fail silently
|
# To be threadsafe, updates/inserts are allowed to fail silently
|
||||||
transaction.rollback()
|
transaction.rollback_unless_managed()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
transaction.commit_unless_managed()
|
transaction.commit_unless_managed()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user