Ticket #17408: formtools-cleanup.diff

File formtools-cleanup.diff, 7.6 KB (added by steph, 13 years ago)
  • django/contrib/formtools/tests/wizard/__init__.py

    diff --git a/django/contrib/formtools/tests/wizard/__init__.py b/django/contrib/formtools/tests/wizard/__init__.py
    index dce2fed..85d2b73 100644
    a b from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage  
    44from django.contrib.formtools.tests.wizard.namedwizardtests.tests import (
    55    NamedSessionWizardTests,
    66    NamedCookieWizardTests,
    7     TestNamedUrlSessionFormWizard,
    8     TestNamedUrlCookieFormWizard,
     7    TestNamedUrlSessionWizardView,
     8    TestNamedUrlCookieWizardView,
    99    NamedSessionFormTests,
    1010    NamedCookieFormTests,
    1111)
  • django/contrib/formtools/tests/wizard/namedwizardtests/tests.py

    diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
    index 0f63882..3870dea 100644
    a b class NamedFormTests(object):  
    319319        instance.render_done(None)
    320320        self.assertEqual(instance.storage.current_step, 'start')
    321321
    322 class TestNamedUrlSessionFormWizard(NamedUrlSessionWizardView):
     322class TestNamedUrlSessionWizardView(NamedUrlSessionWizardView):
    323323
    324324    def dispatch(self, request, *args, **kwargs):
    325         response = super(TestNamedUrlSessionFormWizard, self).dispatch(request, *args, **kwargs)
     325        response = super(TestNamedUrlSessionWizardView, self).dispatch(request, *args, **kwargs)
    326326        return response, self
    327327
    328 class TestNamedUrlCookieFormWizard(NamedUrlCookieWizardView):
     328class TestNamedUrlCookieWizardView(NamedUrlCookieWizardView):
    329329
    330330    def dispatch(self, request, *args, **kwargs):
    331         response = super(TestNamedUrlCookieFormWizard, self).dispatch(request, *args, **kwargs)
     331        response = super(TestNamedUrlCookieWizardView, self).dispatch(request, *args, **kwargs)
    332332        return response, self
    333333
    334334
    335335class NamedSessionFormTests(NamedFormTests, TestCase):
    336     formwizard_class = TestNamedUrlSessionFormWizard
     336    formwizard_class = TestNamedUrlSessionWizardView
    337337    wizard_urlname = 'nwiz_session'
    338338
    339339
    340340class NamedCookieFormTests(NamedFormTests, TestCase):
    341     formwizard_class = TestNamedUrlCookieFormWizard
     341    formwizard_class = TestNamedUrlCookieWizardView
    342342    wizard_urlname = 'nwiz_cookie'
  • 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..d1776de 100644
    a b class CookieStorage(storage.BaseStorage):  
    2020        except KeyError:
    2121            data = None
    2222        except BadSignature:
    23             raise SuspiciousOperation('FormWizard cookie manipulated')
     23            raise SuspiciousOperation('WizardView cookie manipulated')
    2424        if data is None:
    2525            return None
    2626        return json.loads(data, cls=json.JSONDecoder)
  • django/contrib/formtools/wizard/views.py

    diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
    index 15ba146..badb2bf 100644
    a b class WizardView(TemplateView):  
    102102    @classonlymethod
    103103    def as_view(cls, *args, **kwargs):
    104104        """
    105         This method is used within urls.py to create unique formwizard
     105        This method is used within urls.py to create unique wizardview
    106106        instances for every request. We need to override this method because
    107         we add some kwargs which are needed to make the formwizard usable.
     107        we add some kwargs which are needed to make the wizardview usable.
    108108        """
    109109        initkwargs = cls.get_initkwargs(*args, **kwargs)
    110110        return super(WizardView, cls).as_view(**initkwargs)
    class WizardView(TemplateView):  
    117117
    118118        * `form_list` - is a list of forms. The list entries can be single form
    119119          classes or tuples of (`step_name`, `form_class`). If you pass a list
    120           of forms, the formwizard will convert the class list to
     120          of forms, the wizardview will convert the class list to
    121121          (`zero_based_counter`, `form_class`). This is needed to access the
    122122          form for a specific step.
    123123        * `initial_dict` - contains a dictionary of initial data dictionaries.
    class WizardView(TemplateView):  
    130130          apply.
    131131        * `condition_dict` - contains a dictionary of boolean values or
    132132          callables. If the value of for a specific `step_name` is callable it
    133           will be called with the formwizard instance as the only argument.
     133          will be called with the wizardview instance as the only argument.
    134134          If the return value is true, the step's form will be used.
    135135        """
    136136        kwargs.update({
    class WizardView(TemplateView):  
    159159                # we need to override the form variable.
    160160                form = form.form
    161161            # check if any form contains a FileField, if yes, we need a
    162             # file_storage added to the formwizard (by subclassing).
     162            # file_storage added to the wizardview (by subclassing).
    163163            for field in form.base_fields.itervalues():
    164164                if (isinstance(field, forms.FileField) and
    165165                        not hasattr(cls, 'file_storage')):
    166166                    raise NoFileStorageConfigured
    167167
    168         # build the kwargs for the formwizard instances
     168        # build the kwargs for the wizardview instances
    169169        kwargs['form_list'] = init_form_list
    170170        return kwargs
    171171
    class WizardView(TemplateView):  
    209209        After processing the request using the `dispatch` method, the
    210210        response gets updated by the storage engine (for example add cookies).
    211211        """
    212         # add the storage engine to the current formwizard instance
     212        # add the storage engine to the current wizardview instance
    213213        self.wizard_name = self.get_wizard_name()
    214214        self.prefix = self.get_prefix()
    215215        self.storage = get_storage(self.storage_name, self.prefix, request,
    class WizardView(TemplateView):  
    512512
    513513        .. code-block:: python
    514514
    515             class MyWizard(FormWizard):
     515            class MyWizard(WizardView):
    516516                def get_context_data(self, form, **kwargs):
    517517                    context = super(MyWizard, self).get_context_data(form, **kwargs)
    518518                    if self.steps.current == 'my_step_name':
    class NamedUrlWizardView(WizardView):  
    636636    def post(self, *args, **kwargs):
    637637        """
    638638        Do a redirect if user presses the prev. step button. The rest of this
    639         is super'd from FormWizard.
     639        is super'd from WizardView.
    640640        """
    641641        prev_step = self.request.POST.get('wizard_prev_step', None)
    642642        if prev_step and prev_step in self.get_form_list():
    class NamedUrlWizardView(WizardView):  
    646646
    647647    def render_next_step(self, form, **kwargs):
    648648        """
    649         When using the NamedUrlFormWizard, we have to redirect to update the
     649        When using the NamedUrlWizardView, we have to redirect to update the
    650650        browser's URL to match the shown step.
    651651        """
    652652        next_step = self.get_next_step()
    class NamedUrlSessionWizardView(NamedUrlWizardView):  
    680680
    681681class NamedUrlCookieWizardView(NamedUrlWizardView):
    682682    """
    683     A NamedUrlFormWizard with pre-configured CookieStorageBackend.
     683    A NamedUrlWizardView with pre-configured CookieStorageBackend.
    684684    """
    685685    storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
    686686
Back to Top