summaryrefslogtreecommitdiff
path: root/django/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'django/middleware')
-rw-r--r--django/middleware/cache.py2
-rw-r--r--django/middleware/common.py4
-rw-r--r--django/middleware/doc.py2
-rw-r--r--django/middleware/gzip.py2
-rw-r--r--django/middleware/http.py2
-rw-r--r--django/middleware/locale.py2
-rw-r--r--django/middleware/transaction.py2
7 files changed, 9 insertions, 7 deletions
diff --git a/django/middleware/cache.py b/django/middleware/cache.py
index b5e142a383..5510eba714 100644
--- a/django/middleware/cache.py
+++ b/django/middleware/cache.py
@@ -3,7 +3,7 @@ from django.core.cache import cache
from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers
from django.http import HttpResponseNotModified
-class CacheMiddleware:
+class CacheMiddleware(object):
"""
Cache middleware. If this is enabled, each Django-powered page will be
cached for CACHE_MIDDLEWARE_SECONDS seconds. Cache is based on URLs.
diff --git a/django/middleware/common.py b/django/middleware/common.py
index 763918878a..acd3233e1d 100644
--- a/django/middleware/common.py
+++ b/django/middleware/common.py
@@ -3,7 +3,7 @@ from django import http
from django.core.mail import mail_managers
import md5, os
-class CommonMiddleware:
+class CommonMiddleware(object):
"""
"Common" middleware for taking care of some basic operations:
@@ -39,6 +39,8 @@ class CommonMiddleware:
# trailing slash or a file extension.
if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not in old_url[1].split('/')[-1]):
new_url[1] = new_url[1] + '/'
+ if settings.DEBUG and request.META['REQUEST_METHOD'].lower() == 'post':
+ raise RuntimeError, "You called this URL via POST, 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 slash), or set APPEND_SLASH=False in your Django settings." % (new_url[0], new_url[1])
if new_url != old_url:
# Redirect
if new_url[0]:
diff --git a/django/middleware/doc.py b/django/middleware/doc.py
index 6376fe4d5c..01c09e9c15 100644
--- a/django/middleware/doc.py
+++ b/django/middleware/doc.py
@@ -1,7 +1,7 @@
from django.conf import settings
from django import http
-class XViewMiddleware:
+class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py
index 201bec2000..cc8a68406c 100644
--- a/django/middleware/gzip.py
+++ b/django/middleware/gzip.py
@@ -4,7 +4,7 @@ from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
-class GZipMiddleware:
+class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that caches will base their storage
diff --git a/django/middleware/http.py b/django/middleware/http.py
index 2bccd60903..0a8cd67dfa 100644
--- a/django/middleware/http.py
+++ b/django/middleware/http.py
@@ -1,6 +1,6 @@
import datetime
-class ConditionalGetMiddleware:
+class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
diff --git a/django/middleware/locale.py b/django/middleware/locale.py
index e3c95766c9..dd154e1280 100644
--- a/django/middleware/locale.py
+++ b/django/middleware/locale.py
@@ -3,7 +3,7 @@
from django.utils.cache import patch_vary_headers
from django.utils import translation
-class LocaleMiddleware:
+class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the current
diff --git a/django/middleware/transaction.py b/django/middleware/transaction.py
index da218ac31a..4128e012f2 100644
--- a/django/middleware/transaction.py
+++ b/django/middleware/transaction.py
@@ -1,7 +1,7 @@
from django.conf import settings
from django.db import transaction
-class TransactionMiddleware:
+class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct