# HG changeset patch # User Jeff Hammel # Date 1330620313 28800 # Node ID ab52f46a368250d7f3053848479285617f8237c8 # Parent 058182b7b3099e4a0d3bf7abe18b3ef639b4bbf8 remove cruft diff -r 058182b7b309 -r ab52f46a3682 simpypi/wsgi.py --- a/simpypi/wsgi.py Wed Feb 29 20:32:26 2012 -0800 +++ b/simpypi/wsgi.py Thu Mar 01 08:45:13 2012 -0800 @@ -11,64 +11,33 @@ class SimPyPI(object): - ### class level variables -# XXX unneeded for now -# defaults = {'auto_reload': 'False', -# 'template_dirs': '', -# } - def __init__(self, directory, index=None): self.directory = directory assert os.path.exists(directory) - # set instance parameters from kw and defaults -# XXX unneeded for now -# for key in self.defaults: -# setattr(self, key, kw.get(key, self.defaults[key])) -# self.auto_reload = self.auto_reload.lower() == 'true' - # request handlers self.handlers = dict([(method, getattr(self, method)) for method in ('GET', 'POST')]) -# XXX unneeded for now -# self.handlers = [ Index ] + # TODO: HEAD, OPTIONS, maybe more # cache index HTML self.index = index or os.path.join(here, 'templates', 'index.html') assert os.path.exists(self.index) self.index = file(self.index).read() - # template directories -# self.template_dirs = self.template_dirs.split() -# self.template_dirs = [os.path.join(here, 'templates')] - def __call__(self, environ, start_response): # get a request object request = Request(environ) - # get the path - # path = request.path_info.strip('/').split('/') - # if path == ['']: - # path = [] - # request.environ['path'] = path - # match the request to a handler handler = self.handlers.get(request.method) if handler: res = handler(request) else: res = exc.HTTPNotFound() -# for h in self.handlers: -# handler = h.match(self, request) -# if handler is not None: -# break -# else: -# handler = exc.HTTPNotFound - # get response -# res = handler() return res(environ, start_response) def GET(self, request): @@ -80,6 +49,5 @@ # get the package package = self.request.POST.get('package') - # redirect to the main page - # TODO + # TODO: redirect to the main page # self.redirect(self.link(self.handler_path))