当前位置: 首页>>代码示例>>Python>>正文


Python apis.Page方法代码示例

本文整理汇总了Python中apis.Page方法的典型用法代码示例。如果您正苦于以下问题:Python apis.Page方法的具体用法?Python apis.Page怎么用?Python apis.Page使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apis的用法示例。


在下文中一共展示了apis.Page方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def index(*, page = '1'):
    '''
    summary = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
    blogs = [
        Blog(id='1', name='Test blog', summary = summary, created_at = time.time()-120),
        Blog(id='2', name='Javascript IT', summary = summary, created_at = time.time()-3600),
        Blog(id='3', name='Learn Swift', summary = summary, created_at = time.time()-7200),
    ]
    '''
    page_index = get_page_index(page)
    num = yield from Blog.find_number('count(id)')
    page = Page(num, page_index)
    if num == 0:
        blogs = []
    else:
        blogs = yield from Blog.find_all(order_by='created_at desc', limit=(page.offset, page.limit))

    return {
        '__template__': 'blogs.html',
        'page': page,
        'blogs': blogs
    } 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:24,代码来源:handlers.py

示例2: index

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def index(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    page = Page(num, page_index)
    if num == 0:
        blogs = []
    else:
        blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(page.offset, page.limit))
    # ?????????????????????
    # app.py?response_factory???handler.py??????????
    return {
        '__template__': 'blogs.html',
        'page': page,
        'blogs': blogs
    }


# day11??
# ???????? 
开发者ID:ReedSun,项目名称:Preeminent,代码行数:21,代码来源:handlers.py

示例3: index

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def index(request,*,page='1'):
	page_index = get_page_index(page)
	num = await Blog.findNumber('count(id)')
	page = Page(num,page_index)
	if page == 0:
		blogs = []
	else:
		blogs = await Blog.findAll(orderBy = 'created_at desc',limit=(page.offset,page.limit))
	return{
		'__template__' : 'blogs.html',
		'page' : page,
		'blogs' : blogs,
		'__user__' : request.__user__
	} 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:16,代码来源:handlers.py

示例4: api_comments

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
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) 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:10,代码来源:handlers.py

示例5: api_get_users

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
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',limit=(p.offset,p.limit))
	for u in users:
		u.passwd = '******'
	return dict(page=p,users=users) 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:12,代码来源:handlers.py

示例6: api_blogs

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
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=0,blogs={})
	blogs = await Blog.findAll(orderBy='created_at desc',limit=(p.offset,p.limit))
	return dict(page=p,blogs=blogs) 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:10,代码来源:handlers.py

示例7: api_get_users

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_get_users(request, *, page = '1'):
    '''get all users'''
    check_admin(request)
    page_index = get_page_index(page)
    num = yield from User.find_number('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page = p, users = ())
    users = yield from User.find_all(order_by='created_at desc', limit = (p.offset, p.limit))
    for u in users:
        u.password = '*' * 8
    return dict(page = p, users = users) 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:14,代码来源:handlers.py

示例8: api_blogs

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_blogs(*, page = '1'):
    page_index = get_page_index(page)
    num = yield from Blog.find_number('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page = p, blogs = ())
    blogs = yield from Blog.find_all(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, blogs=blogs) 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:10,代码来源:handlers.py

示例9: api_comments

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_comments(*, page = '1'):
    '''get all comments.'''
    page_index = get_page_index(page)
    num = yield from Comment.find_number('count(id)')
    p = Page(num, page_index)
    if num == 0:
        return dict(page = p, comments = ())
    comments = yield from Comment.find_all(order_by = 'created_at desc', limit = (p.offset, p.limit))
    return dict(page = p, comments = comments) 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:11,代码来源:handlers.py

示例10: _get_blogs_by_page

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def _get_blogs_by_page():
    total = Blog.count_all()
    page = Page(total, _get_page_index())
    blogs = Blog.find_by(
        'order by created_at desc limit ?,?', page.offset, page.limit)
    return blogs, page 
开发者ID:tzshlyt,项目名称:python-webapp-blog,代码行数:8,代码来源:urls.py

示例11: api_get_comments

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_get_comments():
    total = Comment.count_all()
    page = Page(total, _get_page_index())
    comments = Comment.find_by(
        'order by created_at desc limit ?,?', page.offset, page.limit)
    return dict(comments=comments, page=page) 
开发者ID:tzshlyt,项目名称:python-webapp-blog,代码行数:8,代码来源:urls.py

示例12: api_get_users

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_get_users():
    total = User.count_all()
    page = Page(total, _get_page_index())
    users = User.find_by(
        'order by created_at desc limit ?,?', page.offset, page.limit)
    for u in users:
        u.password = '******'
    return dict(users=users, page=page) 
开发者ID:tzshlyt,项目名称:python-webapp-blog,代码行数:10,代码来源:urls.py

示例13: api_blogs

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_blogs(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)') # num?????
    p = Page(num, page_index)  # ??Page???Page???apis.py????
    if num == 0:
        return dict(page=p, blogs=())  # ?????0,????,??app.py?response??????
    # ??????0,??????????
    # limit??select??????????,?????????,?????????????
    blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, blogs=blogs)  # ????,??response?????

# day14??
# API????? 
开发者ID:ReedSun,项目名称:Preeminent,代码行数:15,代码来源:handlers.py

示例14: api_comments

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def api_comments(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Comment.findNumber('count(id)')  # num?????
    p = Page(num, page_index)  # ??Page?????????
    if num == 0:
        return dict(page=p, comments=())  # ???????????????app.py?response??????
    # ??????0,??????????
    # limit??select??????????,?????????,?????????????
    comments = yield from Comment.findAll(orderBy='created_at desc', limit=(p.offset, p.limit))
    return dict(page=p, comments=comments)

# day14??
# API????? 
开发者ID:ReedSun,项目名称:Preeminent,代码行数:15,代码来源:handlers.py

示例15: index

# 需要导入模块: import apis [as 别名]
# 或者: from apis import Page [as 别名]
def index(*, page='1'):
    page_index = get_page_index(page)
    num = yield from Blog.findNumber('count(id)')
    page = Page(num)
    if num == 0:
        blogs = []
    else:
        blogs = yield from Blog.findAll(orderBy='created_at desc', limit=(page.offset, page.limit))
    return {
        '__template__': 'blogs.html',
        'page': page,
        'blogs': blogs
    } 
开发者ID:xsingHu,项目名称:xs-python-architecture,代码行数:15,代码来源:handlers.py


注:本文中的apis.Page方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。