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

  try:
    roleName = json.loads(request.POST['roleName'])
    privilege = json.loads(request.POST['privilege'])

    result['privileges'] = _hive_add_privileges(request.user, {'name': roleName}, [privilege])

    result['message'] = roleName % _('Privilege granted successfully to %s.')
    result['status'] = 0
  except Exception, e:
    LOG.exception("could not grant privileges")

    result['message'] = unicode(str(e), "utf8")

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