diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-03-01 20:11:24 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-03-01 20:11:24 +0000 |
| commit | b3a56755d7f0761a14541bd6d86b9960bb5de202 (patch) | |
| tree | e5d996457c2219f663ef92c57bf812aba2f668e5 /tests/regressiontests | |
| parent | 6e748b5db4ea6db78ce389f474c2fb78ee3976ed (diff) | |
Fixed #11012: don't needless convert cache values to unicode.
This means you can now successfully store binary blogs, such as compressed data,
in the cache.
Thanks to Matt Croydon for the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/cache/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py index 9ed93e8750..109374c46c 100644 --- a/tests/regressiontests/cache/tests.py +++ b/tests/regressiontests/cache/tests.py @@ -295,6 +295,16 @@ class BaseCacheTests(object): self.cache.set(key, value) self.assertEqual(self.cache.get(key), value) + def test_binary_string(self): + # Binary strings should be cachable + from zlib import compress, decompress + value = 'value_to_be_compressed' + compressed_value = compress(value) + self.cache.set('binary1', compressed_value) + compressed_result = self.cache.get('binary1') + self.assertEqual(compressed_value, compressed_result) + self.assertEqual(value, decompress(compressed_result)) + def test_set_many(self): # Multiple keys can be set using set_many self.cache.set_many({"key1": "spam", "key2": "eggs"}) |
