Checks if a user hasn't already voted
    :param cmt_id: comment id
    :param client_ip_address: IP => use: str(req.remote_ip)
    :param uid: user id, as given by invenio.legacy.webuser.getUid(req)

def check_user_can_vote(cmt_id, client_ip_address, uid=-1):
    """ Checks if a user hasn't already voted
    :param cmt_id: comment id
    :param client_ip_address: IP => use: str(req.remote_ip)
    :param uid: user id, as given by invenio.legacy.webuser.getUid(req)
    """
    cmt_id = wash_url_argument(cmt_id, 'int')
    client_ip_address = wash_url_argument(client_ip_address, 'str')
    uid = wash_url_argument(uid, 'int')
    query = """SELECT "id_cmtRECORDCOMMENT"
               FROM "cmtACTIONHISTORY"
               WHERE "id_cmtRECORDCOMMENT"=%s"""
    params = (cmt_id,)
    if uid < 0:
        query += " AND client_host=inet_aton(%s)"
        params += (client_ip_address,)
    else:
        query += " AND id_user=%s"
        params += (uid, )
    res = run_sql(query, params)
    return (len(res) == 0)