Beispiel #1
0
def blogs():
    blogs = Blogs()
    page = request.args.get('page')
    pagesize = request.args.get('pagesize')
    print page
    print pagesize
    if page and type(page) == int:
        data = blogs.getBlobsBySite(request.args.get('type'))

    data = blogs.getBlobsBySite(request.args.get('type'))
    return render_template('list.html', data=data)
Beispiel #2
0
def getBlogs():
    site = request.args.get('site')
    page_str = request.args.get('page')
    pagesize_str = request.args.get('pagesize')
    try:
        page = int(page_str) if page_str is not None else 1
        pagesize = int(pagesize_str) if pagesize_str is not None else 20
        count = Blogs.getCountBySite(site)
        res = getSuccessResult(count, page, pagesize)
        data = Blogs.getBlobsBySite(site, page=page, pagesize=pagesize)
        res['data'] = []
        for msg in data:
            res['data'].append(msg.to_dict())
        pass
    except Exception, e:
        traceback.print_exc()
        res = BASE_ERROR_RES.copy()
        res['message'] = e.message