Fixing invalid feed tags.

This commit is contained in:
Samuel Clay 2010-08-24 16:22:12 -04:00
parent 0deb0aff2f
commit 389157e2f0

View file

@ -82,6 +82,9 @@ class Feed(models.Model):
if status_code >= 400:
fetch_history = self.feed_fetch_history.all().values('status_code')
self.count_errors_in_history(fetch_history)
elif self.has_exception:
self.has_exception = False
self.save()
def save_page_history(self, status_code, message, exception=None):
PageFetchHistory.objects.create(feed=self,
@ -95,6 +98,9 @@ class Feed(models.Model):
if status_code >= 400:
fetch_history = self.page_fetch_history.all().values('status_code')
self.count_errors_in_history(fetch_history)
elif self.has_exception:
self.has_exception = False
self.save()
def count_errors_in_history(self, fetch_history):
non_errors = [h for h in fetch_history if int(h['status_code']) < 400]
@ -104,9 +110,6 @@ class Feed(models.Model):
self.has_exception = True
self.active = False
self.save()
elif self.has_exception:
self.has_exception = False
self.save()
def count_subscribers(self, verbose=False, lock=None):
from apps.reader.models import UserSubscription