Django

Code

Changeset 6709

Show
Ignore:
Timestamp:
11/21/07 13:54:58 (9 months ago)
Author:
gwilson
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/cache/backends/locmem.py

    r6572 r6709  
    1717    def add(self, key, value, timeout=None): 
    1818        self._lock.writer_enters() 
     19        # Python 2.3 and 2.4 don't allow combined try-except-finally blocks. 
    1920        try: 
    20             SimpleCacheClass.add(self, key, value, timeout) 
     21            try: 
     22                super(CacheClass, self).add(key, pickle.dumps(value), timeout) 
     23            except pickle.PickleError: 
     24                pass 
    2125        finally: 
    2226            self._lock.writer_leaves() 
     
    5054    def set(self, key, value, timeout=None): 
    5155        self._lock.writer_enters() 
     56        # Python 2.3 and 2.4 don't allow combined try-except-finally blocks. 
    5257        try: 
    5358            try: