コード例 #1
0
ファイル: system_messages.py プロジェクト: Qwlouse/Findeco
def post_node_was_unflagged_message(path, user):
    post = Post()
    post.location = backend.get_node_for_path(path)
    post.author = get_system_user()
    post.post_type = Post.SPAM_UNMARKED
    post.save()
    post.mentions = [user]
    post.node_references = [post.location]
    post.render()
    return post
コード例 #2
0
ファイル: system_messages.py プロジェクト: Qwlouse/Findeco
def post_new_argument_for_node_message(user, path, arg_type, arg_path):
    post = Post()
    post.location = backend.get_node_for_path(path)
    post.author = get_system_user()
    post.post_type = Post.ARGUMENT_CREATED
    post.save()
    post.mentions = [user]
    post.node_references = [backend.get_node_for_path(arg_path), post.location]
    post.render()

    # email notification
    notify_new_argument(post.location, 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
コード例 #4
0
ファイル: factory.py プロジェクト: nagyistoce/Findeco
def create_post_from_schema(schema):
    """
    Creates a Post-object out of a Post-schema and saved it to the database.
    The Object is returned.
    """
    post = Post.objects.create(author_id=schema['author'],
                               post_type=Post.short_post_type(schema['type']),
                               text_template=schema['template_text'],
                               location_id=schema['location'],
                               is_answer_to=schema['answer_to'])
    post.mentions = schema['mentions']
    post.node_references = schema['references']
    return post
コード例 #5
0
ファイル: feeds.py プロジェクト: Lhurgoyfina/Findeco
    def get_object(self, request, rsstype , rsskey , name):
        self.rsstype = rsstype

        if rsskey_is_valid(rsskey, name):
            self.link = FINDECO_BASE_URL + "/feeds/rss/timeline/" + name + "/rsskey/"
            self.feed_url = self.link
            self.feed_guid = hashlib.md5(self.link)
            options = {}
            user = assert_active_user(name)
            if rsstype == "timeline":
                self.title = "Findeco - Timeline"
                self.description = "Deine Findeco Timeline"
                return get_posts(get_timeline_query(user), options)
            if rsstype == "mention":
                self.title = "Findeco - Mentions"
                self.description = "Posts in denen @%s erwähnt wird." % name
                return get_posts(get_mentions_query(user), options)
            if rsstype == "news":
                self.title = "Findeco - News"
                self.description = "Deine Findeco News"
                return get_posts(Q(), options)
            if rsstype == "newsAuthor":
                self.title = "Findeco - Autor News"
                self.description = "Posts von @%s." % name
                return get_posts(get_microblogging_from_user_query(user),
                                 options)
            if rsstype == "newsFollow":
                self.title = "Findeco - Folge News"
                self.description = "News zu Vorschlägen denen @%s folgt." % name
                return get_posts(
                    get_microblogging_for_followed_nodes_query(user), options)

        else:
            err = Post()
            err.title = "Non Matching Path"
            err.author.username = "******"
            return [err]
コード例 #6
0
ファイル: feeds.py プロジェクト: nagyistoce/Findeco
    def get_object(self, request, rsstype, rsskey, name):
        self.rsstype = rsstype

        if rsskey_is_valid(rsskey, name):
            self.link = FINDECO_BASE_URL + "/feeds/rss/timeline/" + name + "/rsskey/"
            self.feed_url = self.link
            self.feed_guid = hashlib.md5(self.link)
            options = {}
            user = assert_active_user(name)
            if rsstype == "timeline":
                self.title = "Findeco - Timeline"
                self.description = "Deine Findeco Timeline"
                return get_posts(get_timeline_query(user), options)
            if rsstype == "mention":
                self.title = "Findeco - Mentions"
                self.description = "Posts in denen @%s erwähnt wird." % name
                return get_posts(get_mentions_query(user), options)
            if rsstype == "news":
                self.title = "Findeco - News"
                self.description = "Deine Findeco News"
                return get_posts(Q(), options)
            if rsstype == "newsAuthor":
                self.title = "Findeco - Autor News"
                self.description = "Posts von @%s." % name
                return get_posts(get_microblogging_from_user_query(user),
                                 options)
            if rsstype == "newsFollow":
                self.title = "Findeco - Folge News"
                self.description = "News zu Vorschlägen denen @%s folgt." % name
                return get_posts(
                    get_microblogging_for_followed_nodes_query(user), options)

        else:
            err = Post()
            err.title = "Non Matching Path"
            err.author.username = "******"
            return [err]
コード例 #7
0
ファイル: factory.py プロジェクト: Lhurgoyfina/Findeco
def create_post_from_schema(schema):
    """
    Creates a Post-object out of a Post-schema and saved it to the database.
    The Object is returned.
    """
    post = Post.objects.create(
        author_id=schema['author'],
        post_type=Post.short_post_type(schema['type']),
        text_template=schema['template_text'],
        location_id=schema['location'],
        is_answer_to=schema['answer_to']
    )
    post.mentions = schema['mentions']
    post.node_references = schema['references']
    return post
コード例 #8
0
def post_new_argument_for_node_message(user, path, arg_type, arg_path):
    post = Post()
    post.location = backend.get_node_for_path(path)
    post.author = get_system_user()
    post.post_type = Post.ARGUMENT_CREATED
    post.save()
    post.mentions = [user]
    post.node_references = [backend.get_node_for_path(arg_path), post.location]
    post.render()

    # email notification
    notify_new_argument(post.location, post)
    return post
コード例 #9
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
コード例 #10
0
def post_node_was_unflagged_message(path, user):
    post = Post()
    post.location = backend.get_node_for_path(path)
    post.author = get_system_user()
    post.post_type = Post.SPAM_UNMARKED
    post.save()
    post.mentions = [user]
    post.node_references = [post.location]
    post.render()
    return post