def comment(self, sender_name, post_id, content): post = Post.get(post_id) user = User.get(post.author_id) header = self._comment_header.format( sender_name, post.id, post.title) Notification.create( sender_name, user.username, 'comment', header, content) notification.publish(user.username, json_encode({'unread': 1}))
def at(self, sender_name, usernames, post_id, content): post = Post.get(post_id) for username in usernames: header = self._at_header.format( sender_name, post.id, post.title) Notification.create( sender_name, username, 'at', header, content) notification.publish(username, json_encode({'unread': 1}))