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)
def forum_thread(self): return ThreadPrototype.get_by_id(self.forum_thread_id)
def forum_thread(self): return ThreadPrototype.get_by_id(self.forum_thread_id) @property
def forum_thread(self): return ForumThreadPrototype.get_by_id(self.forum_thread_id) @property