Exemplo n.º 1
0
    def make_atom(self, feed_name, contents):
        feed = AtomFeed(
            feed_name,
            feed_url=request.url,
            url=request.url_root
        )
        for content in contents:
            if not content.channel.include_in_rss:
                continue

            if content.created_by:
                author = content.created_by.name
            else:
                author = Config.get('site', 'site_author', '')

            feed.add(
                content.title,
                cdata(content.get_text()),
                content_type="html",
                author=author,
                url=self.make_external_url(content.get_absolute_url()),
                updated=content.updated_at,
                published=content.created_at
            )
        return feed
Exemplo n.º 2
0
    def render_atom(self, content_type, templates, **context):
        feed_name = (
            f"{app.theme_context.get('SITENAME')}"
            f" | {content_type.title()} | atom feed"
        )
        if context.get('articles_page'):
            contents = context['articles_page'].object_list
        else:
            contents = context['articles']

        feed = AtomFeed(
            feed_name,
            feed_url=request.url,
            url=request.url_root
        )
        for content in contents:
            content = make_model(content)
            feed.add(
                content.title,
                cdata(content.content),
                content_type="html",
                author=content.author,
                url=make_external_url(content.url),
                updated=content.modified,
                published=content.date
            )
        return feed.get_response()
Exemplo n.º 3
0
    def render_atom(self, content_type, templates, **context):
        feed_name = (
            f"{app.theme_context.get('SITENAME')}"
            f" | {content_type.title()} | atom feed"
        )
        if context.get('articles_page'):
            contents = context['articles_page'].object_list
        else:
            contents = context['articles']

        feed = AtomFeed(
            feed_name,
            feed_url=request.url,
            url=request.url_root
        )
        for content in contents:
            content = make_model(content)
            feed.add(
                content.title,
                cdata(content.content),
                content_type="html",
                author=content.author,
                url=make_external_url(content.url),
                updated=content.modified,
                published=content.date
            )
        return feed.get_response()
Exemplo n.º 4
0
    def make_atom(self, feed_name, contents):
        feed = AtomFeed(feed_name, feed_url=request.url, url=request.url_root)
        for content in contents:
            if not content.channel.include_in_rss:
                continue

            if content.created_by:
                author = content.created_by.name
            else:
                author = Config.get('site', 'site_author', '')

            feed.add(content.title,
                     cdata(content.get_text()),
                     content_type="html",
                     author=author,
                     url=self.make_external_url(content.get_absolute_url()),
                     updated=content.updated_at,
                     published=content.created_at)
        return feed