本文整理汇总了Python中x84.bbs.DBProxy.values方法的典型用法代码示例。如果您正苦于以下问题:Python DBProxy.values方法的具体用法?Python DBProxy.values怎么用?Python DBProxy.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x84.bbs.DBProxy
的用法示例。
在下文中一共展示了DBProxy.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refresh_automsg
# 需要导入模块: from x84.bbs import DBProxy [as 别名]
# 或者: from x84.bbs.DBProxy import values [as 别名]
def refresh_automsg(idx):
""" Refresh automsg database, display automsg of idx, return idx. """
session.flush_event('automsg')
autodb = DBProxy('automsg')
automsgs = sorted(autodb.values()) if len(autodb) else db_firstrecord
dblen = len(automsgs)
# bounds check
if idx < 0:
idx = dblen - 1
elif idx > dblen - 1:
idx = 0
tm_ago, handle, msg = automsgs[idx]
asc_ago = u'%s ago' % (timeago(time.time() - tm_ago))
disp = (u''.join(('\r\n\r\n',
term.bold(handle.rjust(max_user)),
term.bold_blue(u'/'),
term.blue(u'%*d' % (len('%d' % (dblen,)), idx,)),
term.bold_blue(u':'),
term.blue_reverse(msg.ljust(automsg_len)),
term.bold(u'\\'),
term.blue(asc_ago),)))
echo(u''.join((
u'\r\n\r\n',
Ansi(disp).wrap(term.width),
)))
return idx