Kaydet (Commit) 933b9e8d authored tarafından Adrian Holovaty's avatar Adrian Holovaty

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

Fixed #6991 -- Removed some redundant user.is_authenticated() calls in 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
üst 8a109a7b
......@@ -139,7 +139,7 @@ class AdminSite(object):
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):
"""
......
......@@ -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>.
......
......@@ -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)
......
......@@ -12,7 +12,7 @@ class XViewMiddleware(object):
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
......@@ -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.")
# ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment