From: W. Trevor King Date: Sun, 30 Jun 2013 14:35:33 +0000 (-0400) Subject: feed: Only fetch if we haven't already (or if we're forcing a fetch) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=55d2346a68cd897cfdb1e9d481fbe899629a0d0d;p=pycalendar.git feed: Only fetch if we haven't already (or if we're forcing a fetch) --- 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={