Commit Graph

77 Commits

Author SHA1 Message Date
Andrew Godwin 222a5ed69e Reverting [16376] in preparation for reverting [16356]. See #16182.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16425 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-17 09:47:01 +00:00
Jannis Leidel 3d970762af Fixed naming of test methods for the sake of consistency.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-14 10:35:13 +00:00
Jannis Leidel b5e7eab9fd Fixed #16236 -- Added get_form_kwargs method to WizardView as a way to easily provide kwargs to each step form.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-14 10:35:02 +00:00
Ramiro Morales 7116c31373 Fixed incompatibility (`with` statement usage) with Python 2.5 introduced in [16368]. Thanks ojii for the report via IRC.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-12 23:50:37 +00:00
Andrew Godwin e096d56406 Fixed #16222: Test failures due to more precise cookie timings. Refs [16356].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16376 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 19:27:32 +00:00
Jannis Leidel 703498b1c8 Fixed #16179 -- Extended argument handling of the new WizardView a little to behave the same as the rest of the generic class based views. Also cleaned up the template loading in its tests a bit. Thanks, Harro van der Klauw.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16368 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 15:11:56 +00:00
Luke Plant 0b7fc04691 Reverted most of [16051], because it was thoroughly incorrect (whatever some validator says)
Refs #16154

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-04 21:51:13 +00:00
Jannis Leidel 9abe734b83 Fixed #16141 -- Fixed typos in new form wizard.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16309 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-01 20:14:25 +00:00
Jannis Leidel 632dfa2338 Fixed #9200 -- Added new form wizard to formtools based on class based views. Many thanks to Stephan Jäkel, ddurham and ElliottM for their work.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-01 13:47:00 +00:00
Luke Plant 7b129a82b3 Fixed #11726 - FormWizard does sanity check on step number performed before dynamic steps can be inserted
Thanks to Eric Friesen for the report and michalm/esper256 for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16119 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-28 14:19:25 +00:00
Luke Plant 2bb3401d06 Fixed various validation errors caught by the validator.nu HTML5 validator.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16051 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-20 17:41:04 +00:00
Russell Keith-Magee 4749159d48 Silenced a DeprecationWarning in formtools caused by testing the deprecated security_hash function
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 13:26:19 +00:00
Russell Keith-Magee d60ae0b721 Removed deprecated 'no' translation
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15988 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 08:43:43 +00:00
Russell Keith-Magee c1df35b0fa Advanced deprecations in contrib.formtools.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 08:34:15 +00:00
Luke Plant c922a04675 Updated FormPreview to use form_hmac rather than the old security_hash function
This ought to have been done in [14218], but although the FormPreview class
was modified, and some tests were added, the crucial lines of code were not
changed (the 'FormPreview.security_hash' method), and tests for the new
behaviour were not added.  So it is being changed now.  Unlike some of the
other code in that changeset, this does not need to have a compatibility
fallback to cope with existing hashes, because the consequence of a failed
hash is minimal - the user is re-presented with the preview stage of the
form, which will then have a correct hash.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-30 17:35:01 +00:00
Luke Plant fa4bbfcbfb Removed Django 1.2 compatibility fallback for form wizard hash
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-30 17:34:49 +00:00
Adrian Holovaty a89ee065a1 Removed no-longer-valid comment about Python 2.3 and 2.4 in formtools/utils.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 02:26:15 +00:00
Adrian Holovaty a87be3554f Removed a bunch of Python 2.4 workarounds now that we don't support it. Refs #15702 -- thanks to jonash for the patch. Splitting this over muliple commits to make it more manageable.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 01:40:43 +00:00
Jannis Leidel ada8e2a6fa Pulled translation updates from Transifex again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15886 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-20 22:16:14 +00:00
Ramiro Morales 5347bbd514 Fixed plural forms formula for the Croatian (hr) localization by manually overriding the header of affected .po files and re-generating .mo files, this seems to be a quirck in Transifex export to PO functionality. Thanks bmihelac fot the report. Refs #15634.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-17 22:56:10 +00:00
Jannis Leidel 25f975a729 Pulled formtools translation updates from Transifex.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-15 20:09:10 +00:00
Jannis Leidel 90564a156c Fixed Hungarian, Russian, Serbian and Ukranian plural forms introduced in r15680.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-04 01:07:11 +00:00
Jannis Leidel c11140d04b Fixed plural forms of Irish translation introduced in r15680.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-04 01:05:10 +00:00
Jannis Leidel 53b2a25396 Fixed plural forms of Welsh translation introduced in r15680.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-04 01:04:31 +00:00
Jannis Leidel bef353873e Fixed plural forms of Bosnian translation introduced in r15680.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-04 01:03:14 +00:00
Russell Keith-Magee afd040d4d3 Updated test assertions that have been deprecated by the move to unittest2. In summary, this means:
assert_ -> assertTrue
 assertEquals -> assertEqual
 failUnless -> assertTrue

For full details, see http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 15:04:39 +00:00
Jannis Leidel 533517ec65 Updated formtools translations from transifex.net. Refs #15300.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-01 09:02:40 +00:00
Russell Keith-Magee 7536f63b32 Fixed #14768 -- Added an es_MX locale and initial translation. Thanks to Alonso Bautista Villalobos and the rest of the Mexican translation team.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15433 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-06 06:06:29 +00:00
Jannis Leidel 3238b6866f Added new translation files to formtools contrib app.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15264 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-21 18:31:00 +00:00
Luke Plant b7ce6b03bb Corrected hash in a formtools test to match current method, not Django 1.2
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-13 23:19:10 +00:00
Luke Plant cfcb591dd8 Fixed some bugs with formtools tests.
Without these checks, it is possible for the tests to pass by virtue of
asserts never being reached for some reason (very possible in this case, due
to handling of security hashes).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-13 23:18:54 +00:00
Luke Plant a6b9dbc57c Fixed #15075 - No longer possible to alter the form_list in FormWizard.process_step
Thanks to niels, stas for the report, and stas for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15196 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-13 21:58:11 +00:00
Alex Gaynor 5bc0ec4ec4 Removed all usages of deprecated TestCase methods (self.fail*). This removed most of the Warnings emitted (with -Wall) during the test suite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-04 07:28:12 +00:00
Honza Král 70b3ac1f07 Few improvements to FormPreview, thanks Andy!
This commit adds several new hooks in backwards-compatible way:
 * get_initial to specify initial data based on request
 * get_auto_id to enable different AUTO_ID values
 * get_context for overriding and extending default context contents

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 13:47:38 +00:00
Luke Plant b84838aef4 Fixed #14576 - FormWizard.done() method doesn't get passed the last form in the list
Thanks to cyberdelia for report and test, and steph for the initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-16 14:37:00 +00:00
Luke Plant 7d0d3b68d6 Fixed bug and test failure introducted in [14290]
Thanks Russell for alerting me.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-20 07:59:17 +00:00
Luke Plant 46c17654ed Fixed #14498 - Forms passed to FormWizard.process_step are not guaranteed to have cleaned_data
Thanks to stas for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14290 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-19 20:45:40 +00:00
Luke Plant 45c7f427ce Fixed #14445 - Use HMAC and constant-time comparison functions where needed.
All adhoc MAC applications have been updated to use HMAC, using SHA1 to
generate unique keys for each application based on the SECRET_KEY, which is
common practice for this situation. In all cases, backwards compatibility
with existing hashes has been maintained, aiming to phase this out as per
the normal deprecation process. In this way, under most normal
circumstances the old hashes will have expired (e.g. by session expiration
etc.) before they become invalid.

In the case of the messages framework and the cookie backend, which was
already using HMAC, there is the possibility of a backwards incompatibility
if the SECRET_KEY is shorter than the default 50 bytes, but the low
likelihood and low impact meant compatibility code was not worth it.

All known instances where tokens/hashes were compared using simple string
equality, which could potentially open timing based attacks, have also been
fixed using a constant-time comparison function.

There are no known practical attacks against the existing implementations,
so these security improvements will not be backported.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14218 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-14 20:54:30 +00:00
Russell Keith-Magee 121d2e3678 Fixed #12991 -- Added unittest2 support. Thanks to PaulM for the draft patch, and to Luke, Karen, Justin, Alex, Łukasz Rekucki, and Chuck Harmston for their help testing and reviewing the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:55:17 +00:00
Russell Keith-Magee 3c99d06229 Fixed #13951 -- Corrected docstring in formtools wizard. Thanks to suzaku for the report, and lrekucki for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-23 08:11:24 +00:00
Russell Keith-Magee 5211f48ae3 Fixed #12164 -- Removed the Python 2.3 compatibility imports and workarounds. Thanks to timo and claudep for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04 14:00:30 +00:00
Jacob Kaplan-Moss 17c466a57b Fixed a silly bug in [12644].
Kids, please don't drink and code; the commit you save might be your own.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01 23:59:22 +00:00
Jacob Kaplan-Moss 4c18facdf7 Fixed #1104: set `FormWizard.extra_context` in `__init__` to avoid context leakage.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12644 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01 23:26:08 +00:00
Russell Keith-Magee 41c30f2fb8 Fixed #12981 -- Removed some stray tabs. Thanks to loewis for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-27 05:38:17 +00:00
Justin Bronn a9b2ac25d1 Fixed #9147 -- Added `FormPreview.process_preview` customization hook. Thanks, bthomas and thalin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22 05:00:36 +00:00
Luke Plant 4bff194633 Fixed #12804 - regression with decorating admin views.
This is a BACKWARDS INCOMPATIBLE change, because it removes the flawed
'auto_adapt_to_methods' decorator, and replaces it with 'method_decorator'
which must be applied manually when necessary, as described in the 1.2
release notes.

For users of 1.1 and 1.0, this affects the decorators:

 * login_required
 * permission_required
 * user_passes_test

For those following trunk, this also affects:

 * csrf_protect
 * anything created with decorator_from_middleware 

If a decorator does not depend on the signature of the function it is
supposed to decorate (for example if it only does post-processing of the
result), it will not be affected.
 



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-09 15:02:39 +00:00
Luke Plant 7230a995ce Moved contrib.csrf.* to core code.
There is stub code for backwards compatiblity with Django 1.1 imports.

The documentation has been updated, but has been left in
docs/contrib/csrf.txt for now, in order to avoid dead links to
documentation on the website.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-27 00:36:34 +00:00
Luke Plant 8e70cef9b6 Fixed #9977 - CsrfMiddleware gets template tag added, session dependency removed, and turned on by default.
This is a large change to CSRF protection for Django.  It includes:

 * removing the dependency on the session framework.
 * deprecating CsrfResponseMiddleware, and replacing with a core template tag.
 * turning on CSRF protection by default by adding CsrfViewMiddleware to
   the default value of MIDDLEWARE_CLASSES.
 * protecting all contrib apps (whatever is in settings.py)
   using a decorator.

For existing users of the CSRF functionality, it should be a seamless update,
but please note that it includes DEPRECATION of features in Django 1.1,
and there are upgrade steps which are detailed in the docs.

Many thanks to 'Glenn' and 'bthomas', who did a lot of the thinking and work
on the patch, and to lots of other people including Simon Willison and
Russell Keith-Magee who refined the ideas.

Details of the rationale for these changes is found here:

http://code.djangoproject.com/wiki/CsrfProtection

As of this commit, the CSRF code is mainly in 'contrib'.  The code will be
moved to core in a separate commit, to make the changeset as readable as
possible.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-26 23:23:07 +00:00
Jacob Kaplan-Moss 96b5b6b34c Fixed #10643: fixed the formtools security hash to handle allowed empty forms or forms without changed data.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10753 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-12 22:02:38 +00:00
Jacob Kaplan-Moss fce800f3fd Fixed #10034: the formtools security hash function is now friendlier to browsers that submit leading/trailing whitespace in form fields.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-12 21:54:58 +00:00