Ticket #6084: tummy_memcache_thread_safe_warning.diff

File tummy_memcache_thread_safe_warning.diff, 720 bytes (added by mcroydon, 17 years ago)

Add warning about older python-memcached versions and thread safety.

  • django/core/cache/backends/memcached.py

    diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
    index 096cec0..3a5c15d 100644
    a b try:  
    88except ImportError:
    99    try:
    1010        import memcache
     11        bits = memcache.__version__.split('.')
     12        try:
     13            if int(bits[0]) <=1 and int(bits[1]) < 40:
     14                import warnings
     15                warnings.warn("python-memcached backend before 1.40 is known to not be thread-safe.")
     16        except:
     17            pass
    1118    except:
    1219        raise InvalidCacheBackendError("Memcached cache backend requires either the 'memcache' or 'cmemcache' library")
    1320
Back to Top