mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -25,7 +25,7 @@ class CommonMiddleware(object):
|
||||
"""
|
||||
|
||||
# Check for denied User-Agents
|
||||
if request.META.has_key('HTTP_USER_AGENT'):
|
||||
if 'HTTP_USER_AGENT' in request.META:
|
||||
for user_agent_regex in settings.DISALLOWED_USER_AGENTS:
|
||||
if user_agent_regex.search(request.META['HTTP_USER_AGENT']):
|
||||
return http.HttpResponseForbidden('<h1>Forbidden</h1>')
|
||||
|
||||
Reference in New Issue
Block a user