--- spyce_svn/spyceWWW.py 2008-08-04 22:50:21.539048328 +0600 +++ spyce/spyceWWW.py 2008-08-04 22:31:11.502047116 +0600 @@ -99,7 +99,8 @@ def log_message(self, *args): spyce.request_log.info(*args) def do_GET(self): - if spyce.getServer().config.check_modules_and_restart: + config = spyce.getServer().config + if config.check_modules_and_restart: L = spyceUtil.scan_modules() if L: self.send_response(200) @@ -118,10 +119,24 @@ if pathinfo[0:len(os.sep)]==os.sep: pathinfo=pathinfo[len(os.sep):] if pathinfo[0:len(os.pardir)]==os.pardir: pathinfo=pathinfo[len(os.pardir):] self.pathinfo = "/"+pathinfo + # convert to path path = os.path.join(self.server.documentRoot, pathinfo) + if not os.path.exists(path): + # check for path.spy, path.html, etc. + for ext in config.indexExtensions: + ext = path+'.'+ext + if os.path.exists(ext): + path = ext + break + else: + # try rewriting + try: + path = os.path.join(self.server.documentRoot, config.rewrite) # convert to path + print 'Rewrite to', path + except: pathinfo = False # re-use pathinfo as flag-404 - if os.path.exists(path): + if pathinfo != False: if os.path.isdir(path): # directory listing pathparts = self.path.split('?', 1) @@ -132,7 +147,7 @@ return # check for index.spy, index.html, etc. indexFile = None - for findex in spyce.getServer().config.indexFiles: + for findex in config.indexFiles: p2 = os.path.join(path, findex) if os.path.exists(p2): indexFile = p2; break if indexFile is None: handler_type = '/'