async def api_datasource_findAll(*, page='1'):
    page_index = get_page_index(page)
    num = await DataSource.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, comments=())
    datasources = await DataSource.findAll(orderBy='created_at desc',
                                           limit=(p.offset, p.limit))
    return dict(page=p, datasources=datasources)
Exemplo n.º 2
0
async def api_blogs(*, page='1'):
    page_index = get_page_index(page)
    num = await Blog.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, blogs=())
    blogs = await Blog.findAll(orderBy='created_at desc',
                               limit=(p.offset, p.limit))
    return dict(page=p, blogs=blogs)
Exemplo n.º 3
0
async def api_comments(*, page='1'):
    page_index = get_page_index(page)
    num = await Comment.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, comments=())
    comments = await Comment.findAll(orderBy='created_at desc',
                                     limit=(p.offset, p.limit))
    return dict(page=p, comments=comments)
Exemplo n.º 4
0
async def api_get_users(*, page='1'):
    page_index = get_page_index(page)
    num = await User.findNumber('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page=p, users=())
    users = await User.findAll(orderBy='created_at desc')
    for u in users:
        u.passwd = '******'
    return dict(page=p, users=users)
Exemplo n.º 5
0
def manage_resources_domain(*, page='1'):
    return {
        '__template__': 'resources_domain.html',
        'page_index': get_page_index(page)
    }
Exemplo n.º 6
0
def manage_metadata(*, page='1'):
    return {
        '__template__': 'metadata.html',
        'page_index': get_page_index(page)
    }
Exemplo n.º 7
0
def manage_datasources(*, page='1'):
    return {
        '__template__': 'datasources.html',
        'page_index': get_page_index(page)
    }
Exemplo n.º 8
0
def manage_comments(*, page='1'):
    return {
        '__template__': 'manage_comments.html',
        'page_index': get_page_index(page)
    }