# HG changeset patch # User Jeff Hammel # Date 1309934272 25200 # Node ID b8c636b0b567883c08d921734bdb8c1caa481f4e # Parent f60ad139acc1079846de58c28c8163dd36a4beb1 make work for non pastescript frameworks diff -r f60ad139acc1 -r b8c636b0b567 setup.py --- a/setup.py Tue Feb 02 17:58:00 2010 +0000 +++ b/setup.py Tue Jul 05 23:37:52 2011 -0700 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = "0.2.3" +version = "0.2.4" setup(name='uploader', version=version, diff -r f60ad139acc1 -r b8c636b0b567 uploader/handlers.py --- a/uploader/handlers.py Tue Feb 02 17:58:00 2010 +0000 +++ b/uploader/handlers.py Tue Jul 05 23:37:52 2011 -0700 @@ -20,11 +20,11 @@ return '/'.join(path) def redirect(self, location): - raise exc.HTTPSeeOther(location=location) + return exc.HTTPSeeOther(location=location) class Get(Handler): - form = """
+ form = """
""" @classmethod @@ -34,7 +34,11 @@ return request.method == 'GET' def __call__(self): - return Response(content_type='text/html', body=self.form) + form = "" + if 'uploaded' in self.request.GET: + form += '
%s uploaded successfully
' % self.request.GET['uploaded'] + form += self.form + '' + return Response(content_type='text/html', body=form) class Post(Handler): @@ -53,7 +57,7 @@ fin = self.request.POST['file'] _path = os.path.join(self.app.directory, fin.filename) self.write(fin, _path) - self.redirect(self.link('/')) + return self.redirect(self.link('/?uploaded=' + fin.filename)) def path(directory, request): if os.sep == '/': @@ -85,5 +89,5 @@ _path = path(self.app.directory, self.request) _path = os.path.join(_path, fin.filename) self.write(fin, _path) - self.redirect(self.link(self.request.path_info)) + return self.redirect(self.link(self.request.path_info))