def _user_has_perm(user, perm, obj):
 for backend in auth.get_backends():
  if (not hasattr(backend, 'has_perm')):
   continue
  try:
   if backend.has_perm(user, perm, obj):
    return True
  except PermissionDenied:
   return False
 return False

def _user_has_perm ( user , perm , obj ) : for backend in auth . get_backends ( ) : if ( not hasattr ( backend , 'has_perm' ) ) : continue try : if backend . has_perm ( user , perm , obj ) : return True except PermissionDenied : return False return False
a backend can raise permissiondenied to short-circuit permission checking .