From 55d2346a68cd897cfdb1e9d481fbe899629a0d0d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 30 Jun 2013 10:35:33 -0400 Subject: [PATCH] feed: Only fetch if we haven't already (or if we're forcing a fetch) --- pycalendar/feed.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pycalendar/feed.py b/pycalendar/feed.py index 52240c2..2e90438 100644 --- a/pycalendar/feed.py +++ b/pycalendar/feed.py @@ -73,7 +73,12 @@ class Feed (object): def __repr__(self): return '<{} url:{}>'.format(type(self).__name__, self.url) - def fetch(self): + def fetch(self, force=False): + if self.content is None or force: + self._fetch() + self.process() + + def _fetch(self): request = _urllib_request.Request( url=self.url, headers={ -- 2.26.2