diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-03-18 00:17:59 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-03-18 00:17:59 +0000 |
| commit | 17155d38459d46b84d7945f6fb382199ac1961fb (patch) | |
| tree | 3aed99d6fad3228d9513933b43ab365f82012d74 | |
| parent | 8e14a4e6d7718cb1c1866453bc6b404df0c938b4 (diff) | |
Fixed corner-case bug in formtools wizard.py and preview.py, in case of a None value -- thanks, Honza
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7277 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/formtools/preview.py | 2 | ||||
| -rw-r--r-- | django/contrib/formtools/wizard.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py index 66583dde95..db5d58e971 100644 --- a/django/contrib/formtools/preview.py +++ b/django/contrib/formtools/preview.py @@ -105,7 +105,7 @@ class FormPreview(object): Subclasses may want to take into account request-specific information such as the IP address. """ - data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY] + data = [(bf.name, bf.data or '') for bf in form] + [settings.SECRET_KEY] # Use HIGHEST_PROTOCOL because it's the most efficient. It requires # Python 2.3, but Django requires 2.3 anyway, so that's OK. pickled = pickle.dumps(data, pickle.HIGHEST_PROTOCOL) diff --git a/django/contrib/formtools/wizard.py b/django/contrib/formtools/wizard.py index ee6d89adae..da2f0d56de 100644 --- a/django/contrib/formtools/wizard.py +++ b/django/contrib/formtools/wizard.py @@ -146,7 +146,7 @@ class FormWizard(object): Subclasses may want to take into account request-specific information,
such as the IP address.
"""
- data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
+ data = [(bf.name, bf.data or '') for bf in form] + [settings.SECRET_KEY]
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
@@ -198,6 +198,7 @@ class FormWizard(object): step_field -- The name of the hidden field containing the step.
step0 -- The current step (zero-based).
step -- The current step (one-based).
+ step_count -- The total number of steps.
form -- The Form instance for the current step (either empty
or with errors).
previous_fields -- A string representing every previous data field,
|
