|
@ -142,7 +142,11 @@ def post_group_topics( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name="home", renderer="home.jinja2") |
|
|
@view_config(route_name="home", renderer="home.jinja2") |
|
|
|
|
|
@view_config(route_name="home_atom", renderer="home.atom.jinja2") |
|
|
|
|
|
@view_config(route_name="home_rss", renderer="home.rss.jinja2") |
|
|
@view_config(route_name="group", renderer="topic_listing.jinja2") |
|
|
@view_config(route_name="group", renderer="topic_listing.jinja2") |
|
|
|
|
|
@view_config(route_name="group_topics_atom", renderer="topic_listing.atom.jinja2") |
|
|
|
|
|
@view_config(route_name="group_topics_rss", renderer="topic_listing.rss.jinja2") |
|
|
@use_kwargs(TopicListingSchema()) |
|
|
@use_kwargs(TopicListingSchema()) |
|
|
def get_group_topics( # noqa |
|
|
def get_group_topics( # noqa |
|
|
request: Request, |
|
|
request: Request, |
|
@ -159,7 +163,9 @@ def get_group_topics( # noqa |
|
|
# period needs special treatment so we can distinguish between missing and None |
|
|
# period needs special treatment so we can distinguish between missing and None |
|
|
period = kwargs.get("period", missing) |
|
|
period = kwargs.get("period", missing) |
|
|
|
|
|
|
|
|
is_home_page = request.matched_route.name == "home" |
|
|
|
|
|
|
|
|
is_home_page = request.matched_route.name in ["home", "home_atom", "home_rss"] |
|
|
|
|
|
is_atom = request.matched_route.name in ["home_atom", "group_topics_atom"] |
|
|
|
|
|
is_rss = request.matched_route.name in ["home_rss", "group_topics_rss"] |
|
|
|
|
|
|
|
|
if is_home_page: |
|
|
if is_home_page: |
|
|
# on the home page, include topics from the user's subscribed groups |
|
|
# on the home page, include topics from the user's subscribed groups |
|
@ -192,6 +198,11 @@ def get_group_topics( # noqa |
|
|
if period is missing: |
|
|
if period is missing: |
|
|
period = default_settings.period |
|
|
period = default_settings.period |
|
|
|
|
|
|
|
|
|
|
|
# force Newest sort order, and All Time period, for RSS feeds |
|
|
|
|
|
if is_atom or is_rss: |
|
|
|
|
|
order = TopicSortOption.NEW |
|
|
|
|
|
period = None |
|
|
|
|
|
|
|
|
# set up the basic query for topics |
|
|
# set up the basic query for topics |
|
|
query = ( |
|
|
query = ( |
|
|
request.query(Topic) |
|
|
request.query(Topic) |
|
@ -285,6 +296,11 @@ def get_group_topics( # noqa |
|
|
else: |
|
|
else: |
|
|
financial_data = None |
|
|
financial_data = None |
|
|
|
|
|
|
|
|
|
|
|
if is_atom: |
|
|
|
|
|
request.response.content_type = "application/atom+xml" |
|
|
|
|
|
if is_rss: |
|
|
|
|
|
request.response.content_type = "application/rss+xml" |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
"group": request.context, |
|
|
"group": request.context, |
|
|
"groups": groups, |
|
|
"groups": groups, |
|
|