Author: gwilson
Date: 2007-11-21 13:54:58 -0600 (Wed, 21 Nov 2007)
New Revision: 6709
Modified:
django/trunk/django/core/cache/backends/locmem.py
Log:
Fixed #5981 -- Fixed failing regression test when using locmem cache backend.
Changed `add` to pickle the value as is done in `set`. Based on patch from
mattmcc.
Modified: django/trunk/django/core/cache/backends/locmem.py
===================================================================
--- django/trunk/django/core/cache/backends/locmem.py 2007-11-20 15:13:55 UTC
(rev 6708)
+++ django/trunk/django/core/cache/backends/locmem.py 2007-11-21 19:54:58 UTC
(rev 6709)
@@ -16,8 +16,12 @@
def add(self, key, value, timeout=None):
self._lock.writer_enters()
+ # Python 2.3 and 2.4 don't allow combined try-except-finally blocks.
try:
- SimpleCacheClass.add(self, key, value, timeout)
+ try:
+ super(CacheClass, self).add(key, pickle.dumps(value), timeout)
+ except pickle.PickleError:
+ pass
finally:
self._lock.writer_leaves()
@@ -49,6 +53,7 @@
def set(self, key, value, timeout=None):
self._lock.writer_enters()
+ # Python 2.3 and 2.4 don't allow combined try-except-finally blocks.
try:
try:
super(CacheClass, self).set(key, pickle.dumps(value), timeout)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---