Refactor subreddit about.json to enable separate api_docs.

This commit is contained in:
Max Goodman
2012-03-21 10:45:08 -07:00
parent ffca452407
commit e62dcd38af
2 changed files with 10 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ def make_map(global_conf={}, app_conf={}):
mc('/about/message/:where', controller='message', action='listing')
mc('/about/log', controller='front', action='moderationlog')
mc('/about', controller='front', action='about')
mc('/about/:location', controller='front',
action='editreddit', location = 'about')

View File

@@ -571,8 +571,8 @@ class FrontController(RedditController):
pane = FlairPane(num, after, reverse, name, user)
elif c.user_is_sponsor and location == 'ads':
pane = RedditAds()
elif (not location or location == "about") and is_api():
return Reddit(content = Wrapped(c.site)).render()
elif (location == "about") and is_api():
return self.redirect(add_sr('about.json'), code=301)
else:
return self.abort404()
@@ -606,6 +606,13 @@ class FrontController(RedditController):
return self._edit_normal_reddit(location, num, after, reverse,
count, created, name, user)
def GET_about(self):
"""Return information about the subreddit.
Data includes the subscriber count, description, and header image."""
if not is_api() or isinstance(c.site, FakeSubreddit):
return self.abort404()
return Reddit(content = Wrapped(c.site)).render()
def GET_awards(self):
"""The awards page."""