Skip to content

Commit

Permalink
Fixed #26460 -- Issued a single warning for invalid cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
suligap authored and charettes committed Apr 4, 2016
1 parent 15a20dc commit d356bb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions django/core/cache/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def validate_key(self, key):
warnings.warn('Cache key contains characters that will cause '
'errors if used with memcached: %r' % key,
CacheKeyWarning)
break

def incr_version(self, key, delta=1, version=None):
"""Adds delta to the cache version for the supplied key. Returns the
Expand Down
2 changes: 1 addition & 1 deletion tests/cache/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def func(key, *args):
warnings.simplefilter("always")
# memcached does not allow whitespace or control characters in keys
cache.set('key with spaces', 'value')
self.assertEqual(len(w), 2)
self.assertEqual(len(w), 1)
self.assertIsInstance(w[0].message, CacheKeyWarning)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
Expand Down

0 comments on commit d356bb6

Please sign in to comment.