Skip to content

Commit bdfbf18

Browse files
authored
Merge pull request django-pylibmc#42 from edmorley/cleanup-backwards-compat
Remove unneeded backwards compatibility support
2 parents ba23b5c + e54ca88 commit bdfbf18

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

django_pylibmc/memcached.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@
1616

1717
from django.conf import settings
1818
from django.core.cache.backends.base import InvalidCacheBackendError
19-
from django.core.cache.backends.memcached import BaseMemcachedCache
19+
from django.core.cache.backends.memcached import BaseMemcachedCache, DEFAULT_TIMEOUT
2020

2121
try:
2222
import pylibmc
2323
from pylibmc import Error as MemcachedError
2424
except ImportError:
2525
raise InvalidCacheBackendError('Could not import pylibmc.')
2626

27-
try:
28-
from django.core.cache.backends.memcached import DEFAULT_TIMEOUT
29-
except ImportError:
30-
DEFAULT_TIMEOUT = None
31-
3227

3328
log = logging.getLogger('django.pylibmc')
3429

@@ -45,20 +40,12 @@
4540
if not pylibmc.support_compression:
4641
warnings.warn('A compression level was provided but pylibmc was '
4742
'not compiled with support for it.')
48-
if not pylibmc.__version__ >= '1.3.0':
49-
warnings.warn('A compression level was provided but pylibmc 1.3.0 '
50-
'or above is required to handle this option.')
51-
5243

5344
# Keyword arguments to configure compression options
54-
# based on capabilities of a provided pylibmc library.
5545
COMPRESS_KWARGS = {
56-
# Requires pylibmc 1.0 and above. Given that the minumum supported
57-
# version (as of now) is 1.1, the parameter is always included.
5846
'min_compress_len': MIN_COMPRESS_LEN,
47+
'compress_level': COMPRESS_LEVEL,
5948
}
60-
if pylibmc.__version__ >= '1.3.0':
61-
COMPRESS_KWARGS['compress_level'] = COMPRESS_LEVEL
6249

6350

6451
class PyLibMCCache(BaseMemcachedCache):

0 commit comments

Comments
 (0)