This commit is contained in:
Andy McKay 2011-02-22 16:53:24 -08:00
Родитель f9d8328ad2
Коммит fd7e200185
2 изменённых файлов: 3 добавлений и 22 удалений

Просмотреть файл

@ -8,8 +8,6 @@ import time
import urllib
from django.conf import settings
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.auth.models import AnonymousUser
from django.contrib.sessions.middleware import SessionMiddleware
from django.http import HttpResponsePermanentRedirect
from django.middleware import common
@ -101,18 +99,6 @@ class NoVarySessionMiddleware(SessionMiddleware):
return new_response
class AMOAuthenticationMiddleware(AuthenticationMiddleware):
def process_request(self, request):
prefixes = request.path.split('/')
if (len(prefixes) > 1 and prefixes[1]
in settings.NO_AUTHENTICATION_PREFIX):
request.user = AnonymousUser()
return
return (super(AMOAuthenticationMiddleware, self)
.process_request(request))
class RemoveSlashMiddleware(object):
"""
Middleware that tries to remove a trailing slash if there was a 404.

Просмотреть файл

@ -165,12 +165,12 @@ ADMIN_MEDIA_PREFIX = '/admin-media/'
# paths that don't require an app prefix
SUPPORTED_NONAPPS = ('admin', 'developers', 'editors', 'img',
'jsi18n', 'localizers', 'media', 'robots.txt',
'statistics', 'services', 'update', 'blocklist')
'statistics', 'services', 'blocklist')
DEFAULT_APP = 'firefox'
# paths that don't require a locale prefix
SUPPORTED_NONLOCALES = ('img', 'media', 'robots.txt', 'services', 'downloads',
'update', 'blocklist')
'blocklist')
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'r#%9w^o_80)7f%!_ir5zx$tu3mupw9u%&s!)-_q%gy7i+fhx#)'
@ -244,7 +244,7 @@ MIDDLEWARE_CLASSES = (
'amo.middleware.CommonMiddleware',
'amo.middleware.NoVarySessionMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'amo.middleware.AMOAuthenticationMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'cake.middleware.CakeCookieMiddleware',
@ -256,11 +256,6 @@ MIDDLEWARE_CLASSES = (
'commonware.middleware.HidePasswordOnException',
)
# URLs that start with this values have an anymous user.
NO_AUTHENTICATION_PREFIX = (
'update',
)
# Auth
AUTHENTICATION_BACKENDS = (
'users.backends.AmoUserBackend',