[1.5.x] Fixed #18026 -- Don't return an anonymous dict if extra_data in storage is empty.
Backport of 97121cb9
from master.
This commit is contained in:
parent
b3887ab98a
commit
fb130cb40e
|
@ -75,3 +75,13 @@ class TestStorage(object):
|
||||||
storage.extra_data = extra_context
|
storage.extra_data = extra_context
|
||||||
storage2 = self.get_storage()('wizard2', request, None)
|
storage2 = self.get_storage()('wizard2', request, None)
|
||||||
self.assertEqual(storage2.extra_data, {})
|
self.assertEqual(storage2.extra_data, {})
|
||||||
|
|
||||||
|
def test_extra_context_key_persistence(self):
|
||||||
|
request = get_request()
|
||||||
|
storage = self.get_storage()('wizard1', request, None)
|
||||||
|
|
||||||
|
self.assertFalse('test' in storage.extra_data)
|
||||||
|
|
||||||
|
storage.extra_data['test'] = True
|
||||||
|
|
||||||
|
self.assertTrue('test' in storage.extra_data)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class BaseStorage(object):
|
||||||
current_step = lazy_property(_get_current_step, _set_current_step)
|
current_step = lazy_property(_get_current_step, _set_current_step)
|
||||||
|
|
||||||
def _get_extra_data(self):
|
def _get_extra_data(self):
|
||||||
return self.data[self.extra_data_key] or {}
|
return self.data[self.extra_data_key]
|
||||||
|
|
||||||
def _set_extra_data(self, extra_data):
|
def _set_extra_data(self, extra_data):
|
||||||
self.data[self.extra_data_key] = extra_data
|
self.data[self.extra_data_key] = extra_data
|
||||||
|
|
Loading…
Reference in New Issue