Mercurial > hg > simpypi
changeset 34:ab52f46a3682
remove cruft
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 01 Mar 2012 08:45:13 -0800 |
parents | 058182b7b309 |
children | 315b7b49eaf4 |
files | simpypi/wsgi.py |
diffstat | 1 files changed, 2 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- 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))