本文整理汇总了Python中r2.models.Inbox._add方法的典型用法代码示例。如果您正苦于以下问题:Python Inbox._add方法的具体用法?Python Inbox._add怎么用?Python Inbox._add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.models.Inbox
的用法示例。
在下文中一共展示了Inbox._add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: notify_mention
# 需要导入模块: from r2.models import Inbox [as 别名]
# 或者: from r2.models.Inbox import _add [as 别名]
def notify_mention(user, thing):
try:
inbox_rel = Inbox._add(user, thing, "mention")
except CreationError:
# this mention was already inserted, ignore it
g.log.error("duplicate mention for (%s, %s)", user, thing)
return
with query_cache.CachedQueryMutator() as m:
m.insert(queries.get_inbox_comment_mentions(user), [inbox_rel])
queries.set_unread(thing, user, unread=True, mutator=m)
示例2: notify_mention
# 需要导入模块: from r2.models import Inbox [as 别名]
# 或者: from r2.models.Inbox import _add [as 别名]
def notify_mention(user, thing):
inbox_rel = Inbox._add(user, thing, "mention")
with query_cache.CachedQueryMutator() as m:
m.insert(queries.get_inbox_comment_mentions(user), [inbox_rel])
queries.set_unread(thing, user, unread=True, mutator=m)