Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #19740 -- Ensured that denied feeds are unsubscribed.

  • Loading branch information...
commit 22f9fcc1bec4b5833702ea5ad675172e639478a5 1 parent 3d592f7
@timgraham timgraham authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 aggregator/models.py
View
14 aggregator/models.py
@@ -46,13 +46,23 @@ def __unicode__(self):
def save(self, **kwargs):
super(Feed, self).save(**kwargs)
- if settings.SUPERFEEDR_CREDS != None and self.approval_status == APPROVED_FEED:
- Subscription.objects.subscribe(self.feed_url, settings.PUSH_HUB)
+ if settings.SUPERFEEDR_CREDS is not None:
+ if self.approval_status == APPROVED_FEED:
+ Subscription.objects.subscribe(self.feed_url, settings.PUSH_HUB)
+ elif self.approval_status == DENIED_FEED:
+ self.unsubscribe()
def delete(self, **kwargs):
super(Feed, self).delete(**kwargs)
if settings.SUPERFEEDR_CREDS is not None:
+ self.unsubscribe()
+
+ def unsubscribe(self):
+ try:
Subscription.objects.get(topic=self.feed_url).unsubscribe()
+ except Subscription.DoesNotExist:
+ pass
+
class FeedItemManager(models.Manager):
def create_or_update_by_guid(self, guid, **kwargs):
Please sign in to comment.
Something went wrong with that request. Please try again.