Ticket #8690: 8690.diff

File 8690.diff, 1.5 KB (added by Ramiro Morales, 16 years ago)

Patch that tries to provide backwards compatibility. No tests and no docs yet, they can be added if idea isn't deeemed wrong

  • django/contrib/formtools/preview.py

    diff -r 1c267332e8fc django/contrib/formtools/preview.py
    a b  
    22Formtools Preview application.
    33"""
    44
    5 import cPickle as pickle
    6 
    7 from django.conf import settings
    85from django.http import Http404
    96from django.shortcuts import render_to_response
    107from django.template.context import RequestContext
    11 from django.utils.hashcompat import md5_constructor
    128from django.contrib.formtools.utils import security_hash
    139
    1410AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter.
     
    2521
    2622    def __call__(self, request, *args, **kwargs):
    2723        stage = {'1': 'preview', '2': 'post'}.get(request.POST.get(self.unused_name('stage')), 'preview')
    28         self.parse_params(*args, **kwargs)
     24        import inspect
     25        if len(inspect.getargspec(self.parse_params)[0]) == 2:
     26            self.parse_params(request, *args, **kwargs)
     27        else:
     28            self.parse_params(*args, **kwargs)
    2929        try:
    3030            method = getattr(self, stage + '_' + request.method.lower())
    3131        except AttributeError:
     
    8080
    8181    # METHODS SUBCLASSES MIGHT OVERRIDE IF APPROPRIATE ########################
    8282
    83     def parse_params(self, *args, **kwargs):
     83    def parse_params(self, request, *args, **kwargs):
    8484        """
    8585        Given captured args and kwargs from the URLconf, saves something in
    8686        self.state and/or raises Http404 if necessary.
Back to Top