Ticket #16393: trac-16393.diff

File trac-16393.diff, 1.3 KB (added by steph, 13 years ago)

Fix without extra tests.

  • django/contrib/formtools/wizard/storage/cookie.py

    diff --git a/django/contrib/formtools/wizard/storage/cookie.py b/django/contrib/formtools/wizard/storage/cookie.py
    index af26e01..b28a6bc 100644
    a b  
    11from django.core.exceptions import SuspiciousOperation
    22from django.core.signing import BadSignature
    33from django.utils import simplejson as json
     4from django.utils.datastructures import MultiValueDict
    45
    56from django.contrib.formtools.wizard import storage
    67
    class CookieStorage(storage.BaseStorage):  
    2324            raise SuspiciousOperation('FormWizard cookie manipulated')
    2425        if data is None:
    2526            return None
    26         return json.loads(data, cls=json.JSONDecoder)
     27
     28        json_data = json.loads(data, cls=json.JSONDecoder)
     29        if self.step_data_key in json_data:
     30            for step, form_data in json_data[self.step_data_key].iteritems():
     31                form_dict = MultiValueDict()
     32                for key, value in form_data.items():
     33                    if isinstance(value, list):
     34                        form_dict.setlist(key, value)
     35                    else:
     36                        form_dict[key] = value
     37                json_data[self.step_data_key][step] = form_dict
     38        return json_data
Back to Top