Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Putting superfeedr credentials as a setting

This improves local dev, so you don't have to have a superfeedr
account as well as improves testing, because it removes unnecessary
mocks.
  • Loading branch information...
commit 9047aad5cdc2a4b17f7af89779c85fc2983dace6 1 parent d413e97
Justin Abrahms justinabrahms authored
6 django_website/aggregator/models.py
View
@@ -45,13 +45,13 @@ def __unicode__(self):
def save(self, **kwargs):
super(Feed, self).save(**kwargs)
- # TODO(justinlilly): It would be nice if we didn't send these in development
- if self.approval_status == APPROVED_FEED:
+ if settings.SUPERFEEDR_CREDS != None and self.approval_status == APPROVED_FEED:
Subscription.objects.subscribe(self.feed_url, settings.PUSH_HUB)
def delete(self, **kwargs):
super(Feed, self).delete(**kwargs)
- Subscription.objects.unsubscribe(self.feed_url, settings.PUSH_HUB)
+ if settings.SUPERFEEDR_CREDS != None:
+ Subscription.objects.unsubscribe(self.feed_url, settings.PUSH_HUB)
class FeedItemManager(models.Manager):
def create_or_update_by_guid(self, guid, **kwargs):
18 django_website/aggregator/tests.py
View
@@ -15,25 +15,7 @@
class AggregatorTests(TestCase):
- class MockSubscription(object):
- class ObjectsClass(object):
- def subscribe(self, *args, **kwargs):
- pass
-
- def unsubscribe(self, *args, **kwargs):
- pass
-
- objects = ObjectsClass()
-
- def tearDown(self):
- models.Subscription = self.old_subscription
-
def setUp(self):
-
- # monkeypatch models.Subscription so we don't send pubsub
- self.old_subscription = models.Subscription
- models.Subscription = AggregatorTests.MockSubscription()
-
# document release necessary to fetch main page
DocumentRelease(version="1.4", scm="svn", scm_url="/path/to/svn", is_default=True).save()
4 django_website/aggregator/utils.py
View
@@ -3,7 +3,7 @@
def push_credentials(hub_url):
"""
Callback for django_push to get a hub's credentials.
-
+
We always use superfeedr so this is easy.
"""
- return tuple(settings.SECRETS['superfeedr_creds'])
+ return tuple(settings.SUPERFEEDR_CREDS)
2  django_website/settings/www.py
View
@@ -14,6 +14,8 @@
# It's a secret to everybody
SECRETS = json.load(open(BASE.ancestor(2).child('secrets.json')))
SECRET_KEY = str(SECRETS['secret_key'])
+# SUPERFEEDR_CREDS is a 2 element list in the form of [email,secretkey]
+SUPERFEEDR_CREDS = SECRETS.get('superfeedr_creds')
ADMINS = (('Adrian Holovaty','holovaty@gmail.com'),('Jacob Kaplan-Moss', 'jacob@jacobian.org'))
MANAGERS = (('Jacob Kaplan-Moss','jacob@jacobian.org'),)
Please sign in to comment.
Something went wrong with that request. Please try again.