  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')):
              return HttpResponse("You can't vote in this poll.")
          # ...
  
  .. function:: decorators.user_passes_test()
  
 
</s> remove         if request.user.is_authenticated() and request.user.is_staff:
 </s> add         if request.user.is_staff: </s> remove         if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or (request.user.is_authenticated() and request.user.is_staff)):
 </s> add         if request.method == 'HEAD' and (request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS or request.user.is_staff): </s> remove         return request.user.is_authenticated() and request.user.is_staff
 </s> add         return request.user.is_staff
        if not request.user.has_perm('polls.can_vote'):
  checks to make sure the user is logged in and has the permission
  ``polls.can_vote``::
  
      def my_view(request):
        if not request.user.has_perm('polls.can_vote'):
              return HttpResponse("You can't vote in this poll.")
          # ...
  
  .. function:: decorators.user_passes_test()
  
keep keep keep keep replace keep keep keep keep keep
 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 
docs/topics/auth.txt