def _user_has_module_perms(user, app_label):
 for backend in auth.get_backends():
  if (not hasattr(backend, 'has_module_perms')):
   continue
  try:
   if backend.has_module_perms(user, app_label):
    return True
  except PermissionDenied:
   return False
 return False

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