本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_activity_avaliable方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_activity_avaliable方法的具体用法?Python QueryHelper.get_activity_avaliable怎么用?Python QueryHelper.get_activity_avaliable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.queryhelper.QueryHelper
的用法示例。
在下文中一共展示了QueryHelper.get_activity_avaliable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_activity_avaliable [as 别名]
def get(self):
"""Get activities.
"""
status = ErrorCode.SUCCESS
try:
res = []
timestamp = self.get_argument('timestamp', None)
if timestamp is None:
res = QueryHelper.get_activity_list(self.db)
elif int(timestamp) == -1:
res = QueryHelper.get_activity_avaliable(self.db)
else:
res = QueryHelper.get_activity_by_begintime(timestamp, self.db)
for r in res:
if r['filename']:
r['filepath'] = self.application.settings[
'activity_path'] + r['filename']
else:
r['filepath'] = ''
r['url'] = r['html_name']
del r['filename']
del r['html_name']
self.write_ret(status,
dict_=DotDict(res=res))
except Exception as e:
logging.exception("[UWEB] Get activities failed. Exception: %s",
e.args)
status = ErrorCode.SERVER_BUSY
self.write_ret(status)