Mercurial > hg > contenttransformer
diff contenttransformer/web.py @ 1:aa491070ccf3
now works, just doesnt do anything, i dont think
author | k0s <k0scist@gmail.com> |
---|---|
date | Wed, 13 Jan 2010 23:58:13 -0500 |
parents | 29805d442afc |
children |
line wrap: on
line diff
--- a/contenttransformer/web.py Mon Jan 11 11:32:24 2010 -0500 +++ b/contenttransformer/web.py Wed Jan 13 23:58:13 2010 -0500 @@ -19,17 +19,17 @@ setattr(self, key, kw.get(key, self.defaults[key])) assert os.path.exists(self.directory) self.transforms = [ [j.strip() for j in i.split('=', 1) ] for i in self.transforms.split(',') if '=' in i] - self.handler = FileTypeTransformer(*self.transforms) + self.transformer = FileTypeTransformer(*self.transforms) if self.app: assert hasattr(self.app, '__call__') ### methods dealing with HTTP def __call__(self, environ, start_response): request = Request(environ) - path = os.path.join(self.directory, request.path_info) - if os.path.exists(path): - handler = + path = os.path.join(self.directory, request.path_info.strip('/')) + if os.path.exists(path) and os.path.isfile(path): + handler = self.transformer(path) + return handler(environ, start_response) else: - handler = exc.HTTPNotFound() - pass # TODO: if self.app ... - return res(environ, start_response) + # TODO: if self.app ... + return exc.HTTPNotFound()(environ, start_response)