This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Change "reddit" to "subreddit" where appropriate

This also adds new routes for /subreddits/ replacing /reddits/, though
the old routes are kept as well for backwards-compatibility
  • Loading branch information...
Deimos committed Mar 13, 2013
1 parent 6976b8d commit 9354da77cdd146d039086ee803bcb0de092f1604
@@ -206,7 +206,7 @@ def __call__(self, environ, start_response):
if sr:
environ['subreddit'] = sr.groups()[0]
environ['PATH_INFO'] = self.sr_pattern.sub('', path) or '/'
- elif path.startswith("/reddits"):
+ elif path.startswith(('/subreddits', '/reddits')):
environ['subreddit'] = 'r'
return self.app(environ, start_response)
View
@@ -68,6 +68,18 @@ def make_map():
mc('/about/:location', controller='front', action='editreddit',
location='about')
+ mc('/subreddits/create', controller='front', action='newreddit')
+ mc('/subreddits/search', controller='front', action='search_reddits')
+ mc('/subreddits/login', controller='forms', action='login')
+ mc('/subreddits/:where', controller='reddits', action='listing',
+ where='popular', requirements=dict(where="popular|new|banned"))
+
+ mc('/subreddits/mine/:where', controller='myreddits', action='listing',
+ where='subscriber',
+ requirements=dict(where='subscriber|contributor|moderator'))
+
+ # These routes are kept for backwards-compatibility reasons
+ # Using the above /subreddits/ ones instead is preferable
mc('/reddits/create', controller='front', action='newreddit')
mc('/reddits/search', controller='front', action='search_reddits')
mc('/reddits/login', controller='forms', action='login')
@@ -381,10 +381,10 @@ def _add_show_comments_link(self, array, article, num, max_comm, gold=False):
@validate(VUser(),
name=nop('name'))
def GET_newreddit(self, name):
- """Create a community form"""
- title = _('create a reddit')
+ """Create a subreddit form"""
+ title = _('create a subreddit')
content=CreateSubreddit(name=name or '')
- res = FormPage(_("create a community"),
+ res = FormPage(_("create a subreddit"),
content=content,
).render()
return res
@@ -785,7 +785,7 @@ def GET_duplicates(self, article, num, after, reverse, count):
@base_listing
@validate(query=nop('q'))
- @api_doc(api_section.subreddits, uri='/reddits/search', extensions=['json', 'xml'])
+ @api_doc(api_section.subreddits, uri='/subreddits/search', extensions=['json', 'xml'])
def GET_search_reddits(self, query, reverse, after, count, num):
"""Search reddits by title and description."""
q = SubredditSearchQuery(query)
@@ -924,7 +924,7 @@ class RedditsController(ListingController):
render_cls = SubredditsPage
def title(self):
- return _('reddits')
+ return _('subreddits')
def keep_fn(self):
base_keep_fn = ListingController.keep_fn(self)
@@ -965,8 +965,8 @@ def query(self):
return reddits
@listing_api_doc(section=api_section.subreddits,
- uri='/reddits/{where}',
- uri_variants=['/reddits/popular', '/reddits/new', '/reddits/banned'])
+ uri='/subreddits/{where}',
+ uri_variants=['/subreddits/popular', '/subreddits/new', '/subreddits/banned'])
def GET_listing(self, where, **env):
self.where = where
return ListingController.GET_listing(self, **env)
@@ -984,11 +984,11 @@ def menus(self):
NavButton(getattr(plurals, "approved submitter"), 'contributor'),
NavButton(plurals.moderator, 'moderator'))
- return [NavMenu(buttons, base_path = '/reddits/mine/',
+ return [NavMenu(buttons, base_path = '/subreddits/mine/',
default = 'subscriber', type = "flatlist")]
def title(self):
- return _('reddits: ') + self.where
+ return _('subreddits: ') + self.where
def query(self):
reddits = SRMember._query(SRMember.c._name == self.where,
@@ -1030,8 +1030,8 @@ def build_listing(self, after=None, **kwargs):
@require_oauth2_scope("mysubreddits")
@validate(VUser())
@listing_api_doc(section=api_section.subreddits,
- uri='/reddits/mine/{where}',
- uri_variants=['/reddits/mine/subscriber', '/reddits/mine/contributor', '/reddits/mine/moderator'])
+ uri='/subreddits/mine/{where}',
+ uri_variants=['/subreddits/mine/subscriber', '/subreddits/mine/contributor', '/subreddits/mine/moderator'])
def GET_listing(self, where='subscriber', **env):
self.where = where
return ListingController.GET_listing(self, **env)
@@ -343,7 +343,7 @@ def set_subreddit():
elif '-' in sr_name:
sr_names = sr_name.split('-')
if not sr_names[0].lower() == All.name.lower():
- redirect_to("/reddits/search?q=%s" % sr_name)
+ redirect_to("/subreddits/search?q=%s" % sr_name)
srs = Subreddit._by_name(sr_names[1:], stale=can_stale).values()
srs = [sr for sr in srs if not isinstance(sr, FakeSubreddit)]
if not srs:
@@ -356,7 +356,7 @@ def set_subreddit():
except NotFound:
sr_name = chksrname(sr_name)
if sr_name:
- redirect_to("/reddits/search?q=%s" % sr_name)
+ redirect_to("/subreddits/search?q=%s" % sr_name)
elif not c.error_page and not request.path.startswith("/api/login/") :
abort(404)
View
@@ -61,8 +61,8 @@
('BAD_STRING', _("you used a character here that we can't handle")),
('BAD_BID', _("your bid must be at least $%(min)d per day and no more than to $%(max)d in total.")),
('ALREADY_SUB', _("that link has already been submitted")),
- ('SUBREDDIT_EXISTS', _('that reddit already exists')),
- ('SUBREDDIT_NOEXIST', _('that reddit doesn\'t exist')),
+ ('SUBREDDIT_EXISTS', _('that subreddit already exists')),
+ ('SUBREDDIT_NOEXIST', _('that subreddit doesn\'t exist')),
('SUBREDDIT_NOTALLOWED', _("you aren't allowed to post there.")),
('SUBREDDIT_REQUIRED', _('you must specify a subreddit')),
('BAD_SR_NAME', _('that name isn\'t going to work')),
@@ -79,7 +79,7 @@
('BAD_EMAILS', _('the following emails are invalid: %(emails)s')),
('NO_EMAILS', _('please enter at least one email address')),
('TOO_MANY_EMAILS', _('please only share to %(num)s emails at a time.')),
- ('OVERSOLD', _('that reddit has already been oversold on %(start)s to %(end)s. Please pick another reddit or date.')),
+ ('OVERSOLD', _('that subreddit has already been oversold on %(start)s to %(end)s. Please pick another subreddit or date.')),
('BAD_DATE', _('please provide a date of the form mm/dd/yyyy')),
('BAD_DATE_RANGE', _('the dates need to be in order and not identical')),
('DATE_RANGE_TOO_LARGE', _('you must choose a date range of less than %(days)s days')),
@@ -91,8 +91,8 @@
('NO_TEXT', _('we need something here')),
('INVALID_CODE', _("we've never seen that code before")),
('CLAIMED_CODE', _("that code has already been claimed -- perhaps by you?")),
- ('NO_SELFS', _("that reddit doesn't allow text posts")),
- ('NO_LINKS', _("that reddit only allows text posts")),
+ ('NO_SELFS', _("that subreddit doesn't allow text posts")),
+ ('NO_LINKS', _("that subreddit only allows text posts")),
('TOO_OLD', _("that's a piece of history now; it's too late to reply to it")),
('BAD_CSS_NAME', _('invalid css name')),
('BAD_CSS', _('invalid css')),
@@ -236,7 +236,7 @@ def thing_attr(self, thing, attr):
if (attr == "_ups" and g.lounge_reddit
and thing.name == g.lounge_reddit):
return 0
- # Don't return accounts_active counts in /reddits
+ # Don't return accounts_active counts in /subreddits
elif (attr == "accounts_active" and isinstance(c.site, SubSR)):
return None
elif attr == 'description_html':
View
@@ -118,7 +118,7 @@ def __getattr__(self, attr):
home = _("home"),
about = _("about"),
edit_subscriptions = _("edit subscriptions"),
- community_settings = _("community settings"),
+ community_settings = _("subreddit settings"),
moderators = _("edit moderators"),
modmail = _("moderator mail"),
contributors = _("edit approved submitters"),
@@ -137,7 +137,7 @@ def __getattr__(self, attr):
popular = _("popular"),
create = _("create"),
- mine = _("my reddits"),
+ mine = _("my subreddits"),
i18n = _("help translate"),
errors = _("errors"),
View
@@ -397,8 +397,8 @@ def rightbox(self):
if self.create_reddit_box and c.user_is_loggedin:
delta = datetime.datetime.now(g.tz) - c.user._date
if delta.days >= g.min_membership_create_community:
- ps.append(SideBox(_('Create your own community'),
- '/reddits/create', 'create',
+ ps.append(SideBox(_('Create your own subreddit'),
+ '/subreddits/create', 'create',
subtitles = rand_strings.get("create_reddit", 2),
show_cover = True, nocname=True))
@@ -1376,12 +1376,12 @@ def build_toolbars(self):
if c.user_is_loggedin:
#add the aliases to "my reddits" stays highlighted
buttons.append(NamedButton("mine",
- aliases=['/reddits/mine/subscriber',
- '/reddits/mine/contributor',
- '/reddits/mine/moderator']))
+ aliases=['/subreddits/mine/subscriber',
+ '/subreddits/mine/contributor',
+ '/subreddits/mine/moderator']))
- return [PageNameNav('reddits'),
- NavMenu(buttons, base_path = '/reddits', type="tabmenu")]
+ return [PageNameNav('subreddits'),
+ NavMenu(buttons, base_path = '/subreddits', type="tabmenu")]
def content(self):
return self.content_stack((self.interestbar, self.searchbar,
@@ -1395,7 +1395,7 @@ def rightbox(self):
subscribe_box = SubscriptionBox(srs,
multi_text=strings.subscribed_multi)
num_reddits = len(subscribe_box.srs)
- ps.append(SideContentBox(_("your front page reddits (%s)") %
+ ps.append(SideContentBox(_("your front page subreddits (%s)") %
num_reddits, [subscribe_box]))
return ps
@@ -1656,9 +1656,9 @@ def my_reddits_dropdown(self):
drop_down_buttons.append(NavButton(menu.edit_subscriptions,
sr_path = False,
css_class = 'bottom-option',
- dest = '/reddits/'))
+ dest = '/subreddits/'))
return SubredditMenu(drop_down_buttons,
- title = _('my reddits'),
+ title = _('my subreddits'),
type = 'srdrop')
def subscribed_reddits(self):
@@ -1744,7 +1744,7 @@ def __init__(self, srs, multi_text=None):
Subreddit.gold_limit - Subreddit.sr_limit)
visible = min(len(srs), Subreddit.gold_limit)
bonus = {"bonus": extra}
- self.goldmsg = _("%(bonus)s bonus reddits") % bonus
+ self.goldmsg = _("%(bonus)s bonus subreddits") % bonus
self.prelink = ["/wiki/faq#wiki_how_many_reddits_can_i_subscribe_to.3F",
_("%s visible") % visible]
@@ -2050,7 +2050,7 @@ def __init__(self, prev_search='', search_params={}, site=None,
class SearchBar(Templated):
- """More detailed search box for /search and /reddits pages.
+ """More detailed search box for /search and /subreddits pages.
Displays the previous search as well as info of the elapsed_time
and num_results if any."""
def __init__(self, header=None, num_results=0, prev_search='',
View
@@ -68,7 +68,7 @@
already_submitted = _("that link has already been submitted, but you can try to [submit it again](%s)."),
- multiple_submitted = _("that link has been submitted to multiple reddits. you can try to [submit it again](%s)."),
+ multiple_submitted = _("that link has been submitted to multiple subreddits. you can try to [submit it again](%s)."),
user_deleted = _("your account has been deleted, but we won't judge you for it."),
@@ -84,21 +84,21 @@
friends = _('to view reddit with only submissions from your friends, use [reddit.com/r/friends](%s)'),
- sr_created = _('your reddit has been created'),
+ sr_created = _('your subreddit has been created'),
more_info_link = _("visit [%(link)s](%(link)s) for more information"),
sr_messages = dict(
- empty = _('you have not subscribed to any reddits.'),
- subscriber = _('below are the reddits you have subscribed to'),
- contributor = _('below are the reddits that you are an approved submitter on.'),
- moderator = _('below are the reddits that you have moderator access to.')
+ empty = _('you have not subscribed to any subreddits.'),
+ subscriber = _('below are the subreddits you have subscribed to'),
+ contributor = _('below are the subreddits that you are an approved submitter on.'),
+ moderator = _('below are the subreddits that you have moderator access to.')
),
- sr_subscribe = _('click the `subscribe` or `unsubscribe` buttons to choose which reddits appear on your front page.'),
+ sr_subscribe = _('click the `subscribe` or `unsubscribe` buttons to choose which subreddits appear on your front page.'),
- searching_a_reddit = _('you\'re searching within the [%(reddit_name)s](%(reddit_link)s) reddit. '+
- 'you can also search within [all reddits](%(all_reddits_link)s)'),
+ searching_a_reddit = _('you\'re searching within the [%(reddit_name)s](%(reddit_link)s) subreddit. '+
+ 'you can also search within [all subreddits](%(all_reddits_link)s)'),
css_validator_messages = dict(
broken_url = _('"%(brokenurl)s" is not a valid URL'),
View
@@ -521,17 +521,16 @@ def unparse(self):
def path_has_subreddit(self):
"""
utility method for checking if the path starts with a
- subreddit specifier (namely /r/ or /reddits/).
+ subreddit specifier (namely /r/ or /subreddits/).
"""
- return (self.path.startswith('/r/') or
- self.path.startswith('/reddits/'))
+ return self.path.startswith(('/r/', '/subreddits/', '/reddits/'))
def get_subreddit(self):
"""checks if the current url refers to a subreddit and returns
that subreddit object. The cases here are:
* the hostname is unset or is g.domain, in which case it
- looks for /r/XXXX or /reddits. The default in this case
+ looks for /r/XXXX or /subreddits. The default in this case
is Default.
* the hostname is a cname to a known subreddit.
@@ -543,7 +542,7 @@ def get_subreddit(self):
if not self.hostname or self.hostname.startswith(g.domain):
if self.path.startswith('/r/'):
return Subreddit._by_name(self.path.split('/')[2])
- elif self.path.startswith('/reddits/'):
+ elif self.path.startswith(('/subreddits/', '/reddits/')):
return Sub
else:
return DefaultSR()
@@ -1257,7 +1257,7 @@ def run(self, name):
if isinstance(s, FakeSubreddit):
raise NotFound, "fake subreddit"
if s._spam:
- raise NotFound, "banned community"
+ raise NotFound, "banned subreddit"
return s
except NotFound:
self.set_error(errors.SUBREDDIT_NOEXIST)
@@ -87,7 +87,7 @@ class Subreddit(Thing, Printable):
over_18 = False,
exclude_banned_modqueue = False,
mod_actions = 0,
- sponsorship_text = "this reddit is sponsored by",
+ sponsorship_text = "this subreddit is sponsored by",
sponsorship_url = None,
sponsorship_img = None,
sponsorship_name = None,
@@ -1282,7 +1282,7 @@ def can_submit(self, user, promotion=False):
@property
def path(self):
- return "/reddits/"
+ return "/subreddits/"
class DomainSR(FakeSubreddit):
@property
@@ -214,7 +214,7 @@
%endif
>
<label for="allow_top">
- ${_("allow this reddit to be shown in the default set")}
+ ${_("allow this subreddit to be shown in the default set")}
</label>
</li>
<li>
@@ -44,11 +44,11 @@ <h1>Request Help</h1>
<dt>Got a bug report?</dt>
<dd><a href="/r/bugs/">Check /r/bugs for other people with the same problem, or submit your own bug report.</a></dd>
<dt>Are you a new moderator? Having trouble staying out of the fray? Need advice?</dt>
- <dd><a href="/r/modhelp">There's a reddit for that</a>.</dd>
+ <dd><a href="/r/modhelp">There's a subreddit for that</a>.</dd>
<dt>Want to advertise but don't know how?</dt>
<dd><a href="/ad_inq">The instructions are here</a>.</dd>
<dt>General questions? Need help?</dt>
- <dd><a href="/r/help">There's a reddit for that, too</a>.</dd>
+ <dd><a href="/r/help">There's a subreddit for that, too</a>.</dd>
<dt>Frustrated? Need a break?</dt>
<% r = random.randint(0,2) %>
%if r == 0:
@@ -27,7 +27,7 @@
checked="checked"
%endif
>
- ${_("Show my flair on this reddit. It looks like:")}
+ ${_("Show my flair on this subreddit. It looks like:")}
</form>
<div class="tagline">${thing.wrapped_user}</div>
%endif
@@ -24,7 +24,7 @@
<div class="content over18" style="text-align: center">
<p class="error">
- ${_("you must be at least eighteen to view this reddit")}
+ ${_("you must be at least eighteen to view this subreddit")}
</p>
<img src="${static('over18.png')}" alt="" height="254" width="180" />
@@ -28,9 +28,9 @@
</span>
</%def>
-<%def name="reddits()">
+<%def name="subreddits()">
<span class="hover pagename redditname">
- ${plain_link(_("reddits"), "/reddits/", _sr_path=False)}
+ ${plain_link(_("subreddits"), "/subreddits/", _sr_path=False)}
</span>
</%def>
Oops, something went wrong.

0 comments on commit 9354da7

Please sign in to comment.