Code

Ticket #17408: formtools-cleanup.diff

File formtools-cleanup.diff, 7.6 KB (added by steph, 2 years ago)
Line 
1diff --git a/django/contrib/formtools/tests/wizard/__init__.py b/django/contrib/formtools/tests/wizard/__init__.py
2index dce2fed..85d2b73 100644
3--- a/django/contrib/formtools/tests/wizard/__init__.py
4+++ b/django/contrib/formtools/tests/wizard/__init__.py
5@@ -4,8 +4,8 @@ from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage
6 from django.contrib.formtools.tests.wizard.namedwizardtests.tests import (
7     NamedSessionWizardTests,
8     NamedCookieWizardTests,
9-    TestNamedUrlSessionFormWizard,
10-    TestNamedUrlCookieFormWizard,
11+    TestNamedUrlSessionWizardView,
12+    TestNamedUrlCookieWizardView,
13     NamedSessionFormTests,
14     NamedCookieFormTests,
15 )
16diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
17index 0f63882..3870dea 100644
18--- a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
19+++ b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
20@@ -319,24 +319,24 @@ class NamedFormTests(object):
21         instance.render_done(None)
22         self.assertEqual(instance.storage.current_step, 'start')
23 
24-class TestNamedUrlSessionFormWizard(NamedUrlSessionWizardView):
25+class TestNamedUrlSessionWizardView(NamedUrlSessionWizardView):
26 
27     def dispatch(self, request, *args, **kwargs):
28-        response = super(TestNamedUrlSessionFormWizard, self).dispatch(request, *args, **kwargs)
29+        response = super(TestNamedUrlSessionWizardView, self).dispatch(request, *args, **kwargs)
30         return response, self
31 
32-class TestNamedUrlCookieFormWizard(NamedUrlCookieWizardView):
33+class TestNamedUrlCookieWizardView(NamedUrlCookieWizardView):
34 
35     def dispatch(self, request, *args, **kwargs):
36-        response = super(TestNamedUrlCookieFormWizard, self).dispatch(request, *args, **kwargs)
37+        response = super(TestNamedUrlCookieWizardView, self).dispatch(request, *args, **kwargs)
38         return response, self
39 
40 
41 class NamedSessionFormTests(NamedFormTests, TestCase):
42-    formwizard_class = TestNamedUrlSessionFormWizard
43+    formwizard_class = TestNamedUrlSessionWizardView
44     wizard_urlname = 'nwiz_session'
45 
46 
47 class NamedCookieFormTests(NamedFormTests, TestCase):
48-    formwizard_class = TestNamedUrlCookieFormWizard
49+    formwizard_class = TestNamedUrlCookieWizardView
50     wizard_urlname = 'nwiz_cookie'
51diff --git a/django/contrib/formtools/wizard/storage/cookie.py b/django/contrib/formtools/wizard/storage/cookie.py
52index af26e01..d1776de 100644
53--- a/django/contrib/formtools/wizard/storage/cookie.py
54+++ b/django/contrib/formtools/wizard/storage/cookie.py
55@@ -20,7 +20,7 @@ class CookieStorage(storage.BaseStorage):
56         except KeyError:
57             data = None
58         except BadSignature:
59-            raise SuspiciousOperation('FormWizard cookie manipulated')
60+            raise SuspiciousOperation('WizardView cookie manipulated')
61         if data is None:
62             return None
63         return json.loads(data, cls=json.JSONDecoder)
64diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
65index 15ba146..badb2bf 100644
66--- a/django/contrib/formtools/wizard/views.py
67+++ b/django/contrib/formtools/wizard/views.py
68@@ -102,9 +102,9 @@ class WizardView(TemplateView):
69     @classonlymethod
70     def as_view(cls, *args, **kwargs):
71         """
72-        This method is used within urls.py to create unique formwizard
73+        This method is used within urls.py to create unique wizardview
74         instances for every request. We need to override this method because
75-        we add some kwargs which are needed to make the formwizard usable.
76+        we add some kwargs which are needed to make the wizardview usable.
77         """
78         initkwargs = cls.get_initkwargs(*args, **kwargs)
79         return super(WizardView, cls).as_view(**initkwargs)
80@@ -117,7 +117,7 @@ class WizardView(TemplateView):
81 
82         * `form_list` - is a list of forms. The list entries can be single form
83           classes or tuples of (`step_name`, `form_class`). If you pass a list
84-          of forms, the formwizard will convert the class list to
85+          of forms, the wizardview will convert the class list to
86           (`zero_based_counter`, `form_class`). This is needed to access the
87           form for a specific step.
88         * `initial_dict` - contains a dictionary of initial data dictionaries.
89@@ -130,7 +130,7 @@ class WizardView(TemplateView):
90           apply.
91         * `condition_dict` - contains a dictionary of boolean values or
92           callables. If the value of for a specific `step_name` is callable it
93-          will be called with the formwizard instance as the only argument.
94+          will be called with the wizardview instance as the only argument.
95           If the return value is true, the step's form will be used.
96         """
97         kwargs.update({
98@@ -159,13 +159,13 @@ class WizardView(TemplateView):
99                 # we need to override the form variable.
100                 form = form.form
101             # check if any form contains a FileField, if yes, we need a
102-            # file_storage added to the formwizard (by subclassing).
103+            # file_storage added to the wizardview (by subclassing).
104             for field in form.base_fields.itervalues():
105                 if (isinstance(field, forms.FileField) and
106                         not hasattr(cls, 'file_storage')):
107                     raise NoFileStorageConfigured
108 
109-        # build the kwargs for the formwizard instances
110+        # build the kwargs for the wizardview instances
111         kwargs['form_list'] = init_form_list
112         return kwargs
113 
114@@ -209,7 +209,7 @@ class WizardView(TemplateView):
115         After processing the request using the `dispatch` method, the
116         response gets updated by the storage engine (for example add cookies).
117         """
118-        # add the storage engine to the current formwizard instance
119+        # add the storage engine to the current wizardview instance
120         self.wizard_name = self.get_wizard_name()
121         self.prefix = self.get_prefix()
122         self.storage = get_storage(self.storage_name, self.prefix, request,
123@@ -512,7 +512,7 @@ class WizardView(TemplateView):
124 
125         .. code-block:: python
126 
127-            class MyWizard(FormWizard):
128+            class MyWizard(WizardView):
129                 def get_context_data(self, form, **kwargs):
130                     context = super(MyWizard, self).get_context_data(form, **kwargs)
131                     if self.steps.current == 'my_step_name':
132@@ -636,7 +636,7 @@ class NamedUrlWizardView(WizardView):
133     def post(self, *args, **kwargs):
134         """
135         Do a redirect if user presses the prev. step button. The rest of this
136-        is super'd from FormWizard.
137+        is super'd from WizardView.
138         """
139         prev_step = self.request.POST.get('wizard_prev_step', None)
140         if prev_step and prev_step in self.get_form_list():
141@@ -646,7 +646,7 @@ class NamedUrlWizardView(WizardView):
142 
143     def render_next_step(self, form, **kwargs):
144         """
145-        When using the NamedUrlFormWizard, we have to redirect to update the
146+        When using the NamedUrlWizardView, we have to redirect to update the
147         browser's URL to match the shown step.
148         """
149         next_step = self.get_next_step()
150@@ -680,7 +680,7 @@ class NamedUrlSessionWizardView(NamedUrlWizardView):
151 
152 class NamedUrlCookieWizardView(NamedUrlWizardView):
153     """
154-    A NamedUrlFormWizard with pre-configured CookieStorageBackend.
155+    A NamedUrlWizardView with pre-configured CookieStorageBackend.
156     """
157     storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
158