Subreddit routing: add /about/sticky redirect

Redirects to the subreddit's current sticky post
This commit is contained in:
Chad Birch
2013-09-30 14:20:26 -06:00
parent fbfe49442d
commit 8096fb3a1d
2 changed files with 9 additions and 0 deletions

View File

@@ -141,6 +141,7 @@ def make_map():
requirements=dict(controller="hot|new|rising|randomrising"))
mc('/about/sidebar', controller='front', action='sidebar')
mc('/about/sticky', controller='front', action='sticky')
mc('/about/flair', controller='front', action='flairlisting')
mc('/about', controller='front', action='about')
mc('/comments/gilded', controller='redirect', action='gilded_comments',

View File

@@ -752,6 +752,14 @@ class FrontController(RedditController, OAuth2ResourceController):
usertext = UserText(c.site, c.site.description)
return Reddit(content=usertext).render()
@require_oauth2_scope("read")
def GET_sticky(self):
if c.site.sticky_fullname:
sticky = Link._by_fullname(c.site.sticky_fullname, data=True)
self.redirect(sticky.make_permalink_slow())
else:
abort(404)
def GET_awards(self):
"""The awards page."""
return BoringPage(_("awards"), content=UserAwards()).render()