diff options
| author | Samuel Colvin <s@muelcolvin.com> | 2015-01-13 13:42:21 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-29 15:23:01 -0500 |
| commit | 5b74134f27eabf92870e1c5e81f9e4999f113eab (patch) | |
| tree | ca1fd0bc9f0514003070ee0841afa1aa6ef3f713 /django/middleware/common.py | |
| parent | eb4cdfbdd64a95b303eaaa40a070521aa58362fd (diff) | |
Fixed #24145 -- Added PUT & PATCH to CommonMiddleware APPEND_SLASH redirect error.
Diffstat (limited to 'django/middleware/common.py')
| -rw-r--r-- | django/middleware/common.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py index 0bf0481df6..0531d31908 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -75,14 +75,14 @@ class CommonMiddleware(object): if (not urlresolvers.is_valid_path(request.path_info, urlconf) and urlresolvers.is_valid_path("%s/" % request.path_info, urlconf)): new_url[1] = new_url[1] + '/' - if settings.DEBUG and request.method == 'POST': + if settings.DEBUG and request.method in ('POST', 'PUT', 'PATCH'): raise RuntimeError(("" - "You called this URL via POST, but the URL doesn't end " + "You called this URL via %(method)s, but the URL doesn't end " "in a slash and you have APPEND_SLASH set. Django can't " - "redirect to the slash URL while maintaining POST data. " - "Change your form to point to %s%s (note the trailing " + "redirect to the slash URL while maintaining %(method)s data. " + "Change your form to point to %(url)s (note the trailing " "slash), or set APPEND_SLASH=False in your Django " - "settings.") % (new_url[0], new_url[1])) + "settings.") % {'method': request.method, 'url': ''.join(new_url)}) if new_url == old_url: # No redirects required. |
