draw the rest of the owl
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from flask import (
|
||||
Blueprint, render_template, request, redirect, url_for, flash, session,
|
||||
abort,
|
||||
abort, current_app
|
||||
)
|
||||
from .users import login_required, mod_only, get_active_user, is_logged_in
|
||||
from ..models import Users, Topics, Threads, Subscriptions
|
||||
from ..constants import InfoboxKind
|
||||
from ..lib.render_atom import render_atom_template
|
||||
from slugify import slugify
|
||||
from app import cache
|
||||
import time
|
||||
import math
|
||||
|
||||
@@ -80,10 +82,27 @@ def topic(slug):
|
||||
subscriptions = subscriptions,
|
||||
topic = target_topic,
|
||||
current_page = page,
|
||||
page_count = page_count
|
||||
page_count = page_count,
|
||||
__feedlink = url_for('.topic_atom', slug=slug, _external=True),
|
||||
__feedtitle = f'latest threads in {target_topic.name}',
|
||||
)
|
||||
|
||||
|
||||
@bp.get('/<slug>/feed.atom')
|
||||
@cache.cached(timeout=10 * 60, unless=lambda: current_app.config.get('DEBUG', False))
|
||||
def topic_atom(slug):
|
||||
target_topic = Topics.find({
|
||||
"slug": slug
|
||||
})
|
||||
if not target_topic:
|
||||
abort(404) # TODO throw an atom friendly 404
|
||||
return
|
||||
|
||||
threads_list = target_topic.get_threads_with_op_rss()
|
||||
|
||||
return render_atom_template('topics/topic.atom', threads_list=threads_list, target_topic=target_topic)
|
||||
|
||||
|
||||
@bp.get("/<slug>/edit")
|
||||
@login_required
|
||||
@mod_only(".topic", slug = lambda slug: slug)
|
||||
|
||||
Reference in New Issue
Block a user