コード例 #1
0
 def test_mail_notify_derivate(self):
     hugo = create_user("hugo")
     hugo.email = "*****@*****.**"
     hugo.profile.wants_mail_notification = True
     hugo.save()
     max = create_user("max")
     max.email = "*****@*****.**"
     max.profile.wants_mail_notification = True
     max.save()
     berta = create_user("berta")
     berta.email = "*****@*****.**"
     berta.profile.wants_mail_notification = False
     berta.save()
     post = create_post('System Message', hugo)
     node = create_nodes_for_path('/foo.1', [hugo])
     create_vote(hugo, [node])
     create_vote(max, [node])
     create_vote(berta, [node])
     derivate = create_nodes_for_path('/foo.2', [hugo])
     node.add_derivate(derivate)
     notify_derivate(node, post)
     self.assertEqual(len(mail.outbox), 1)
     m = mail.outbox[0]
     self.assertEqual(m.to, [])
     self.assertEqual(m.bcc, ['*****@*****.**', '*****@*****.**'])
     self.assertIn('System Message', m.body)
     self.assertGreater(len(m.subject), 0)
コード例 #2
0
def post_new_derivate_for_node_message(user, original_path, derivate_path):
    post = Post()

    original_node = backend.get_node_for_path(original_path)
    derivate_node = backend.get_node_for_path(derivate_path)

    post.location = original_node
    post.post_type = Post.NODE_REFINED
    post.author = get_system_user()
    post.save()
    post.node_references = [original_node, derivate_node]
    post.mentions = [user]
    post.render()

    # email notification
    notify_derivate(original_node, post)
    return post
コード例 #3
0
ファイル: system_messages.py プロジェクト: Qwlouse/Findeco
def post_new_derivate_for_node_message(user, original_path, derivate_path):
    post = Post()

    original_node = backend.get_node_for_path(original_path)
    derivate_node = backend.get_node_for_path(derivate_path)

    post.location = original_node
    post.post_type = Post.NODE_REFINED
    post.author = get_system_user()
    post.save()
    post.node_references = [original_node, derivate_node]
    post.mentions = [user]
    post.render()

    # email notification
    notify_derivate(original_node, post)
    return post