def list_sentry_roles_by_group(request):
  result = {'status': -1, 'message': 'Error'}

  try:
    if request.POST['groupName']:
      groupName = request.POST['groupName']
    else:
      # Admins can see everything, other only the groups they belong too
      groupName = None if request.user.groups.filter(name__in=get_sentry_server_admin_groups()).exists() else '*'
    roles = get_api(request.user).list_sentry_roles_by_group(groupName)
    result['roles'] = sorted(roles, key=lambda role: role['name'])
    result['message'] = ''
    result['status'] = 0
  except Exception, e:
    LOG.exception("could not retrieve roles")

    if str(e) in "couldn't be retrieved.":
      result['roles'] = []
      result['status'] = 0
    else:
      result['message'] = unicode(str(e), "utf8")

  return JsonResponse(result)
dataset/ETHPy150Open cloudera/hue/apps/security/src/security/api/hive.py/list_sentry_roles_by_group/swapped operands of `in`