[etwist] fix static directory serving; closes #2174797 stable
authorFlorent Cayré <florent.cayre@gmail.com>
Thu, 05 Apr 2012 14:44:00 +0200
branchstable
changeset 8341 af813e7d5daa
parent 8339 63348ead09fb
child 8342 7a5271182ef0
[etwist] fix static directory serving; closes #2174797
etwist/server.py
web/webconfig.py
--- a/etwist/server.py	Wed Apr 04 18:44:07 2012 +0200
+++ b/etwist/server.py	Thu Apr 05 14:44:00 2012 +0200
@@ -94,6 +94,15 @@
     def directoryListing(self):
         return ForbiddenDirectoryLister()
 
+    def createSimilarFile(self, path):
+        # we override this method because twisted calls __init__
+        # which we overload with a different signature
+        f = self.__class__(self.config, path)
+        f.processors = self.processors
+        f.indexNames = self.indexNames[:]
+        f.childNotFound = self.childNotFound
+        return f
+
 
 class DataLookupDirectory(NoListingFile):
     def __init__(self, config, path):
--- a/web/webconfig.py	Wed Apr 04 18:44:07 2012 +0200
+++ b/web/webconfig.py	Thu Apr 05 14:44:00 2012 +0200
@@ -21,7 +21,7 @@
 _ = unicode
 
 import os
-from os.path import join, exists, split
+from os.path import join, exists, split, isdir
 from warnings import warn
 
 from logilab.common.decorators import cached
@@ -405,7 +405,8 @@
         rdir, filename = split(rpath)
         if rdir:
             staticdir = join(staticdir, rdir)
-            os.makedirs(staticdir)
+            if not isdir(staticdir) and 'w' in mode:
+                os.makedirs(staticdir)
         return file(join(staticdir, filename), mode)
 
     def static_file_add(self, rpath, data):