<commit_before>from urllib.parse import urljoin
from flask import Blueprint, render_template, request
from werkzeug.contrib.atom import AtomFeed
from teknologkoren_se.models import Post, Event, Contact
from teknologkoren_se.util import bp_url_processors


mod = Blueprint('general', __name__, url_prefix='/<any(sv, en):lang_code>')

bp_url_processors(mod)


@mod.route('/om-oss/')
def about():
    """Show about page."""
    return render_template('general/about.html')


@mod.route('/boka/')
def booking():
    """Show booking page."""
    return render_template('general/booking.html')


@mod.route('/sjung/')
def sing():
    """Show audition page."""
    return render_template('general/sing.html')


@mod.route('/kontakt/')
def contact():
    """Show contact page.

    Order of board members and their email addresses are hard coded.
    The template iterates over the list of tags and gets the user from
    the generated dict to display them in the same order every time.
    """
    contacts = Contact.query.order_by(Contact.weight.asc()).all()
    ordf = Contact.query.filter_by(title='Ordförande').first()

    return render_template('general/contact.html',
                           contacts=contacts,
                           ordf=ordf)


@mod.route('/lucia/')
def lucia():
    ordf = Contact.query.filter_by(title='Ordförande').first()

    return render_template('general/lucia.html',
                           ordf=ordf)


@mod.route('/feed/')
def atom_feed():
    """Generate and return rss-feed."""
    feed = AtomFeed("Teknologkören", feed_url=request.url,
                    url=request.url_root)

    posts = (Post.query
             .filter_by(published=True)
             .order_by(Post.timestamp.desc())
             .limit(15))

    for post in posts:
        if isinstance(post, Event):
            path_base = "konserter/"
        else:
            path_base = "blog/"

        feed.add(post.title,
                 post.content_to_html(),
                 content_type='html',
                 url=urljoin(request.url_root, path_base+post.url),
                 updated=post.timestamp
                 )

    return feed.get_response()<commit_msg>fix rss feed<commit_after>from urllib.parse import urljoin
from flask import Blueprint, render_template, request
from werkzeug.contrib.atom import AtomFeed
from teknologkoren_se.models import Post, Event, Contact
from teknologkoren_se.util import bp_url_processors


mod = Blueprint('general', __name__, url_prefix='/<any(sv, en):lang_code>')

bp_url_processors(mod)


@mod.route('/om-oss/')
def about():
    """Show about page."""
    return render_template('general/about.html')


@mod.route('/boka/')
def booking():
    """Show booking page."""
    return render_template('general/booking.html')


@mod.route('/sjung/')
def sing():
    """Show audition page."""
    return render_template('general/sing.html')


@mod.route('/kontakt/')
def contact():
    """Show contact page.

    Order of board members and their email addresses are hard coded.
    The template iterates over the list of tags and gets the user from
    the generated dict to display them in the same order every time.
    """
    contacts = Contact.query.order_by(Contact.weight.asc()).all()
    ordf = Contact.query.filter_by(title='Ordförande').first()

    return render_template('general/contact.html',
                           contacts=contacts,
                           ordf=ordf)


@mod.route('/lucia/')
def lucia():
    ordf = Contact.query.filter_by(title='Ordförande').first()

    return render_template('general/lucia.html',
                           ordf=ordf)


@mod.route('/feed/')
def atom_feed():
    """Generate and return rss-feed."""
    feed = AtomFeed("Teknologkören", feed_url=request.url,
                    url=request.url_root)

    posts = (Post.query
             .filter_by(published=True)
             .order_by(Post.timestamp.desc())
             .limit(15))

    for post in posts:
        if isinstance(post, Event):
            path_base = "konserter/"
        else:
            path_base = "blog/"

        feed.add(post.title,
                 post.content_to_html(post.content),
                 content_type='html',
                 url=urljoin(request.url_root, path_base+post.url),
                 updated=post.timestamp
                 )

    return feed.get_response()
{'fraction_non_alphanumeric': 0.12611581597619592, 'fraction_numerical': 0.0009155413138017853, 'mean_word_length': 2.587848932676519, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5543923', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1289, 'n_words': 297}