# HG changeset patch # User Florent Cayré # Date 1333629840 -7200 # Node ID af813e7d5daa597307fbeec44f7602a8ed8a91d6 # Parent 63348ead09fb56f9bc9f4d377c6196787b438056 [etwist] fix static directory serving; closes #2174797 diff -r 63348ead09fb -r af813e7d5daa etwist/server.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): diff -r 63348ead09fb -r af813e7d5daa web/webconfig.py --- 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):