# HG changeset patch # User k0s # Date 1261938567 18000 # Node ID a02c4fcd70010ed11d49e91f1c39f600d95910a5 # Parent 827f7577f940c676ddc7583fac6dbb8d138d4230 * optionally require auth * give a real version diff -r 827f7577f940 -r a02c4fcd7001 setup.py --- a/setup.py Sat Nov 21 15:29:03 2009 -0500 +++ b/setup.py Sun Dec 27 13:29:27 2009 -0500 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = "0.0" +version = "0.1" setup(name='uploader', version=version, diff -r 827f7577f940 -r a02c4fcd7001 uploader/dispatcher.py --- a/uploader/dispatcher.py Sat Nov 21 15:29:03 2009 -0500 +++ b/uploader/dispatcher.py Sun Dec 27 13:29:27 2009 -0500 @@ -9,17 +9,21 @@ class Dispatcher(object): ### class level variables - defaults = { 'directory': None} + defaults = { 'directory': None, + 'auth': 'False' } def __init__(self, **kw): for key in self.defaults: setattr(self, key, kw.get(key, self.defaults[key])) self.handlers = [ Get, Post ] assert os.path.exists(self.directory) + self.auth = self.auth.lower() == 'true' ### methods dealing with HTTP def __call__(self, environ, start_response): request = Request(environ) + if self.auth and not request.remote_user: + return exc.HTTPUnauthorized()(environ, start_response) for h in self.handlers: if h.match(request): handler = h(self, request)