Exemplo n.º 1
0
def motion_list(request):
    page_input = request.params.get('page')
    
    page = 0
    try:
        page = int(page_input)
    except: pass
    if not page: page = 1
    
    count = get_motions_count()

    rows_per_page = 5
    
    offset = (page - 1) * rows_per_page
    pages = count / rows_per_page
    if count % rows_per_page <> 0:
        pages += 1

    first_page = False
    last_page = False
    if page == 1:
        first_page = True
    if (rows_per_page * page) >= count:
        last_page = True
    
    return dict(motions=load_motions(offset, rows_per_page), page=page, pages=pages, first_page=first_page, last_page=last_page)
Exemplo n.º 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())
Exemplo n.º 3
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())