feed: Only fetch if we haven't already (or if we're forcing a fetch)
authorW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 14:35:33 +0000 (10:35 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 16:26:18 +0000 (12:26 -0400)
pycalendar/feed.py

index 52240c21057aa9577fce99dae9366c8a5f3d3eab..2e9043857a9067d0cb81c0c2106344fb0bfada09 100644 (file)
@@ -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={