Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Move sr discovery links to zookeeper
Browse files Browse the repository at this point in the history
This change will allow us to change the links without doing a code push
  • Loading branch information
shlurbee committed Aug 13, 2012
1 parent a44f6f4 commit b1ed5e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions r2/example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,5 @@ beaker.session_secret = somesecret
[live_config]
# make frontpage 100% dart
frontpage_dart = false
# spotlight links for subreddit discovery
sr_discovery_links =
4 changes: 2 additions & 2 deletions r2/r2/controllers/listingcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ def spotlight(self):

# If prefs allow it, mix in promoted links and sr discovery content
if c.user.pref_show_sponsors or not c.user.gold:
if hasattr(g, 'sr_discovery_links'):
spotlight_links.extend(g.sr_discovery_links)
if g.live_config['sr_discovery_links']:
spotlight_links.extend(g.live_config['sr_discovery_links'])
random.shuffle(spotlight_links)
spotlight_keep_fn = lambda l: promote.is_promo(l) or organic.keep_fresh_links(l)
num_links = len(spotlight_links)
Expand Down
2 changes: 1 addition & 1 deletion r2/r2/controllers/validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def visible_promo(article):
c.user._id == article.author_id)

# subreddit discovery links are visible even without a live campaign
if article._fullname in getattr(g, 'sr_discovery_links', {}):
if article._fullname in g.live_config['sr_discovery_links']:
return True

# promos are visible only if comments are not disabled and the
Expand Down
4 changes: 3 additions & 1 deletion r2/r2/lib/app_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class Globals(object):
'allowed_pay_countries',
'case_sensitive_domains',
'reserved_subdomains',
'sr_discovery_links'
],

ConfigValue.choice: {
Expand All @@ -181,6 +180,9 @@ class Globals(object):
ConfigValue.bool: [
'frontpage_dart',
],
ConfigValue.tuple: [
'sr_discovery_links',
],
}

def __init__(self, global_conf, app_conf, paths, **extra):
Expand Down

0 comments on commit b1ed5e0

Please sign in to comment.