本文整理汇总了Python中the_tale.forum.prototypes.ThreadPrototype.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadPrototype.get_by_id方法的具体用法?Python ThreadPrototype.get_by_id怎么用?Python ThreadPrototype.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.forum.prototypes.ThreadPrototype
的用法示例。
在下文中一共展示了ThreadPrototype.get_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from the_tale.forum.prototypes import ThreadPrototype [as 别名]
# 或者: from the_tale.forum.prototypes.ThreadPrototype import get_by_id [as 别名]
def process(self):
from the_tale.forum.prototypes import ThreadPrototype, SubscriptionPrototype
thread = ThreadPrototype.get_by_id(self.thread_id)
if thread is None:
return True # thread can be removed by admins or with removed thread
post = thread.get_first_post()
accounts = SubscriptionPrototype.get_accounts_for_subcategory(thread.subcategory)
subject = '«Сказка»: новая тема на форуме'
context = {'thread': thread,
'post': post}
html_content = jinja2.render(self.EMAIL_HTML_TEMPLATE, context)
text_content = jinja2.render(self.EMAIL_TEXT_TEMPLATE, context)
return logic.send_mail(accounts, subject, text_content, html_content)
示例2: forum_thread
# 需要导入模块: from the_tale.forum.prototypes import ThreadPrototype [as 别名]
# 或者: from the_tale.forum.prototypes.ThreadPrototype import get_by_id [as 别名]
def forum_thread(self): return ThreadPrototype.get_by_id(self.forum_thread_id)
@property