summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Jaekel <steph@rdev.info>2013-01-12 12:00:31 +0100
committerClaude Paroz <claude@2xlibre.net>2013-01-12 15:51:15 +0100
commitfb130cb40ea9b93bae741a4f359f19819597a112 (patch)
tree47d65a281cea43ee0038c0681efafb521b948c5e
parentb3887ab98ac5317ebe7889e8b35752ebfd9740f9 (diff)
[1.5.x] Fixed #18026 -- Don't return an anonymous dict if extra_data in storage is empty.
Backport of 97121cb9 from master.
-rw-r--r--django/contrib/formtools/tests/wizard/storage.py10
-rw-r--r--django/contrib/formtools/wizard/storage/base.py2
2 files changed, 11 insertions, 1 deletions
diff --git a/django/contrib/formtools/tests/wizard/storage.py b/django/contrib/formtools/tests/wizard/storage.py
index fe1d96381f..17968dfcda 100644
--- a/django/contrib/formtools/tests/wizard/storage.py
+++ b/django/contrib/formtools/tests/wizard/storage.py
@@ -75,3 +75,13 @@ class TestStorage(object):
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)
diff --git a/django/contrib/formtools/wizard/storage/base.py b/django/contrib/formtools/wizard/storage/base.py
index 2e59679d09..6c155e0ff0 100644
--- a/django/contrib/formtools/wizard/storage/base.py
+++ b/django/contrib/formtools/wizard/storage/base.py
@@ -37,7 +37,7 @@ class BaseStorage(object):
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