[library-web/new-website-style] do not fail caching documents with slashes



commit d78a9acff014536277fe1328ef762af9cf9ae875
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Mar 29 20:35:46 2011 +0530

    do not fail caching documents with slashes

 src/app.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/app.py b/src/app.py
index a8156ae..2413a55 100644
--- a/src/app.py
+++ b/src/app.py
@@ -119,9 +119,9 @@ class App:
 
     def download(self, url, use_cache=True):
         parsed_url = urllib2.urlparse.urlparse(url)
-        if parsed_url[0] == 'file':
+        if parsed_url[0] in ('file', '', None):
             return parsed_url[2]
-        filename = '/'.join(parsed_url[1:3])
+        filename = '/'.join((parsed_url[1], parsed_url[2].replace('/', '__')))
         cache_filename = os.path.join(self.config.download_cache_dir, filename)
         cache_dir = os.path.split(cache_filename)[0]
         if not os.path.exists(cache_dir):



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