diff -r 1c267332e8fc django/contrib/formtools/preview.py
|
a
|
b
|
|
| 2 | 2 | Formtools Preview application. |
| 3 | 3 | """ |
| 4 | 4 | |
| 5 | | import cPickle as pickle |
| 6 | | |
| 7 | | from django.conf import settings |
| 8 | 5 | from django.http import Http404 |
| 9 | 6 | from django.shortcuts import render_to_response |
| 10 | 7 | from django.template.context import RequestContext |
| 11 | | from django.utils.hashcompat import md5_constructor |
| 12 | 8 | from django.contrib.formtools.utils import security_hash |
| 13 | 9 | |
| 14 | 10 | AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter. |
| … |
… |
|
| 25 | 21 | |
| 26 | 22 | def __call__(self, request, *args, **kwargs): |
| 27 | 23 | 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) |
| 29 | 29 | try: |
| 30 | 30 | method = getattr(self, stage + '_' + request.method.lower()) |
| 31 | 31 | except AttributeError: |
| … |
… |
|
| 80 | 80 | |
| 81 | 81 | # METHODS SUBCLASSES MIGHT OVERRIDE IF APPROPRIATE ######################## |
| 82 | 82 | |
| 83 | | def parse_params(self, *args, **kwargs): |
| | 83 | def parse_params(self, request, *args, **kwargs): |
| 84 | 84 | """ |
| 85 | 85 | Given captured args and kwargs from the URLconf, saves something in |
| 86 | 86 | self.state and/or raises Http404 if necessary. |