Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #6991 -- Removed some redundant user.is_authenticated() calls i…

…n various places. Thanks, alexkoshelev, Liang Feng and Ivan Sagalaev

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12142 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 933b9e8de7cfae0a271283c11cccbb9897e30a46 1 parent 8a109a7
Adrian Holovaty adrianholovaty authored
2  django/contrib/admin/sites.py
View
@@ -139,7 +139,7 @@ def has_permission(self, request):
Returns True if the given HttpRequest has permission to view
*at least one* page in the admin site.
"""
- return request.user.is_authenticated() and request.user.is_staff
+ return request.user.is_staff
def check_dependencies(self):
"""
2  django/contrib/admin/templates/admin/base.html
View
@@ -22,7 +22,7 @@
<div id="branding">
{% block branding %}{% endblock %}
</div>
- {% if user.is_authenticated and user.is_staff %}
+ {% if user.is_staff %}
<div id="user-tools">
{% trans 'Welcome,' %}
<strong>{% firstof user.first_name user.username %}</strong>.
2  django/contrib/admin/views/decorators.py
View
@@ -28,7 +28,7 @@ def staff_member_required(view_func):
member, displaying the login page if necessary.
"""
def _checklogin(request, *args, **kwargs):
- if request.user.is_authenticated() and request.user.is_staff:
+ if request.user.is_staff:
# The user is valid. Continue to the admin page.
return view_func(request, *args, **kwargs)
2  django/middleware/doc.py
View
@@ -12,7 +12,7 @@ def process_view(self, request, view_func, view_args, view_kwargs):
indicating the view function. This is used by the documentation module
to lookup the view function for an arbitrary page.
"""
- if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)):
+ if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or request.user.is_staff):
response = http.HttpResponse()
response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)
return response
2  docs/topics/auth.txt
View
@@ -1031,7 +1031,7 @@ checks to make sure the user is logged in and has the permission
``polls.can_vote``::
def my_view(request):
- if not (request.user.is_authenticated() and request.user.has_perm('polls.can_vote')):
+ if not request.user.has_perm('polls.can_vote'):
return HttpResponse("You can't vote in this poll.")
# ...
Please sign in to comment.
Something went wrong with that request. Please try again.