Browse files

Fixed #18026 -- Don't return an anonymous dict if extra_data in stora…

…ge is empty.
  • Loading branch information...
1 parent a170c3f commit 97121cb96e2f9f02f977010b5549b88f1a73610b @stephrdev stephrdev committed with claudep Jan 12, 2013
View
10 django/contrib/formtools/tests/wizard/storage.py
@@ -75,3 +75,13 @@ def test_extra_context(self):
storage.extra_data = extra_context
storage2 = self.get_storage()('wizard2', request, None)
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)
View
2 django/contrib/formtools/wizard/storage/base.py
@@ -37,7 +37,7 @@ def _set_current_step(self, step):
current_step = lazy_property(_get_current_step, _set_current_step)
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):
self.data[self.extra_data_key] = extra_data

0 comments on commit 97121cb

Please sign in to comment.