[library-web] possibility not to use cached version of files



commit 255242d9c89f6883e1bb00f19e3692efca7ca1dd
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Mar 20 12:10:13 2011 +0100

    possibility not to use cached version of files

 src/app.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/app.py b/src/app.py
index 7e3381d..a8156ae 100644
--- a/src/app.py
+++ b/src/app.py
@@ -117,7 +117,7 @@ class App:
                 shutil.rmtree(images_dir)
             shutil.copytree(self.images_dir, os.path.join(self.config.output_dir, 'images'))
 
-    def download(self, url):
+    def download(self, url, use_cache=True):
         parsed_url = urllib2.urlparse.urlparse(url)
         if parsed_url[0] == 'file':
             return parsed_url[2]
@@ -126,7 +126,7 @@ class App:
         cache_dir = os.path.split(cache_filename)[0]
         if not os.path.exists(cache_dir):
             os.makedirs(cache_dir)
-        if not os.path.exists(cache_filename):
+        if not os.path.exists(cache_filename) or not use_cache:
             logging.info('downloading %s' % url)
             try:
                 s = urllib2.urlopen(url).read()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]