Example #1
0
def message_list(request):
    motion_id = request.matchdict["id"]

    motion = load_motion(motion_id)
    if not motion:
        return HTTPBadRequest()

    return dict(motions=load_motions())
Example #2
0
def message_list(request):
    motion_id = request.matchdict['id']

    motion = load_motion(motion_id)
    if not motion:
        return HTTPBadRequest()

    return dict(motions=load_motions())
Example #3
0
def motion_message(request):
    motion_id = request.matchdict['id']
    
    motion = load_motion(motion_id)
    if not motion:
        return HTTPBadRequest()

    if request.params.get('submit') and request.params.get("message"):
        message = request.params.get("message").strip()
        if message:
            add_message(motion_id, message)

    return dict(motion=motion)
Example #4
0
def motion_vote(request):
    motion_id = request.matchdict['id']
    chips = request.matchdict['chips']
    
    motion = load_motion(motion_id)
    if not motion:
        return HTTPBadRequest()

    #validate chips exists and not used
    participant = get_motion_participant_by_chips(motion.id, chips)
    if not participant:
        return HTTPUnauthorized()

    if request.params.get('submit'):
        vote_result = request.params.get("vote")
        save_vote_result(motion_id, vote_result, chips)
        return HTTPFound(location=route_path('motion_vote', request, 
                                                id=motion_id, chips=chips))
    
    return dict(motion=motion, participant=participant)