backported memcache serialization config bug
Change-Id: I8ab630f2a72dc5d5359fac21eeb59590e39b6b45
This commit is contained in:
parent
51611e91a1
commit
50d72a1a80
|
@ -1,3 +1,8 @@
|
|||
swift (1.7.2)
|
||||
|
||||
* Fix issue where memcache serialization was not properly loading
|
||||
the config value
|
||||
|
||||
swift (1.7.0)
|
||||
|
||||
* Use custom encoding for ring data instead of pickle
|
||||
|
|
|
@ -14,7 +14,7 @@ class Version(object):
|
|||
return '%s-dev' % (self.canonical_version,)
|
||||
|
||||
|
||||
_version = Version('1.7.0', True)
|
||||
_version = Version('1.7.2', True)
|
||||
__version__ = _version.pretty_version
|
||||
__canonical_version__ = _version.canonical_version
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ class MemcacheMiddleware(object):
|
|||
self.memcache_servers = '127.0.0.1:11211'
|
||||
if serialization_format is None:
|
||||
serialization_format = 2
|
||||
else:
|
||||
serialization_format = int(serialization_format)
|
||||
|
||||
self.memcache = MemcacheRing(
|
||||
[s.strip() for s in self.memcache_servers.split(',') if s.strip()],
|
||||
|
|
|
@ -48,7 +48,7 @@ class SetConfigParser(object):
|
|||
if option == 'memcache_servers':
|
||||
return '1.2.3.4:5'
|
||||
elif option == 'memcache_serialization_support':
|
||||
return '2'
|
||||
return '1'
|
||||
else:
|
||||
raise NoOptionError(option)
|
||||
else:
|
||||
|
@ -104,6 +104,8 @@ class TestCacheMiddleware(unittest.TestCase):
|
|||
finally:
|
||||
memcache.ConfigParser = orig_parser
|
||||
self.assertEquals(app.memcache_servers, '127.0.0.1:11211')
|
||||
self.assertEquals(app.memcache._allow_pickle, False)
|
||||
self.assertEquals(app.memcache._allow_unpickle, False)
|
||||
|
||||
def test_conf_from_extra_conf(self):
|
||||
orig_parser = memcache.ConfigParser
|
||||
|
@ -113,16 +115,22 @@ class TestCacheMiddleware(unittest.TestCase):
|
|||
finally:
|
||||
memcache.ConfigParser = orig_parser
|
||||
self.assertEquals(app.memcache_servers, '1.2.3.4:5')
|
||||
self.assertEquals(app.memcache._allow_pickle, False)
|
||||
self.assertEquals(app.memcache._allow_unpickle, True)
|
||||
|
||||
def test_conf_from_inline_conf(self):
|
||||
orig_parser = memcache.ConfigParser
|
||||
memcache.ConfigParser = SetConfigParser
|
||||
try:
|
||||
app = memcache.MemcacheMiddleware(
|
||||
FakeApp(), {'memcache_servers': '6.7.8.9:10'})
|
||||
FakeApp(),
|
||||
{'memcache_servers': '6.7.8.9:10',
|
||||
'serialization_format': '0'})
|
||||
finally:
|
||||
memcache.ConfigParser = orig_parser
|
||||
self.assertEquals(app.memcache_servers, '6.7.8.9:10')
|
||||
self.assertEquals(app.memcache._allow_pickle, False)
|
||||
self.assertEquals(app.memcache._allow_unpickle, True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue