本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_single_event_paged方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_single_event_paged方法的具体用法?Python QueryHelper.get_single_event_paged怎么用?Python QueryHelper.get_single_event_paged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_single_event_paged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_single_event_paged [as 别名]
def post(self):
"""Query single-events through start_time, end_time and tid.
"""
status = ErrorCode.SUCCESS
try:
data = DotDict(json_decode(self.request.body))
start_time = data.start_time
end_time = data.end_time
tid = data.tid
# For paging
page_size = int(data.get("pagesize", UWEB.LIMIT.PAGE_SIZE))
page_number = int(data.pagenum)
pagecnt = int(data.pagecnt)
logging.info("[UWEB] Single list request: %s, cid: %s", data, self.current_user.cid)
except Exception as e:
status = ErrorCode.ILLEGAL_DATA_FORMAT
logging.exception("[UWEB] Invalid data format. Exception: %s", e.args)
self.write_ret(status)
return
try:
# NOTE: we need return the event count to GUI at first time query
if pagecnt == -1:
res = QueryHelper.get_single_event(tid, start_time, end_time, self.db)
count = res.count
d, m = divmod(count, page_size)
pagecnt = (d + 1) if m else d
res = QueryHelper.get_single_event_paged(
tid, start_time, end_time, page_number * page_size, page_size, self.db
)
self.write_ret(status, dict_=DotDict(res=res, pagecnt=pagecnt))
except Exception as e:
logging.exception("[UWEB] cid: %s single list failed. Exception: %s", self.current_user.cid, e.args)
status = ErrorCode.SERVER_BUSY
self.write_ret(status)