How to use the feedgenerator.django.utils.feedgenerator function in feedgenerator

To help you get started, we’ve selected a few feedgenerator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rafaelmartins / blohg / blohg / views.py View on Github external
def atom(tag=None):
    """General purpose atom feed."""

    title = current_app.config['TITLE']
    if tag is not None:
        tags = tag.split('/')
        for _tag in tags:
            if _tag not in current_app.blohg.content.tags:
                abort(404)
        title += ' » %s' % ' + '.join(tags)
        posts = current_app.blohg.content.get_by_tag(tags)
    else:
        posts = current_app.blohg.content.get_all(True)
    feed = feedgenerator.Atom1Feed(title=title,
                                   link=url_for('views.home', _external=True),
                                   description=current_app.config['TAGLINE'],
                                   feed_guid=url_for('views.atom', tag=tag),
                                   feed_url=url_for('views.atom', tag=tag,
                                                    _external=True),
                                   author_name=current_app.config['AUTHOR'])
    posts_per_atom_feed = \
        current_app.config.get('POSTS_PER_ATOM_FEED',
                               current_app.config.get('POSTS_PER_PAGE'))
    for post in posts[:int(posts_per_atom_feed)]:
        feed.add_item(title=post.title, content=post.full_raw_html,
                      description=post.abstract_raw_html,
                      unique_id=url_for('views.content', slug=post.slug),
                      link=url_for('views.content', slug=post.slug,
                                   _external=True),
                      author_name=post.author_name,