# HG changeset patch # User Jeff Hammel # Date 1310838513 25200 # Node ID d15f85eb2ab9abbb1c26f138ad30d3f815312bf2 # Parent 657e8df141878d525dc95297fb97a65c2b953cc4 optionally display upload directory contents diff -r 657e8df14187 -r d15f85eb2ab9 uploader/handlers.py --- a/uploader/handlers.py Sat Jul 16 10:38:46 2011 -0700 +++ b/uploader/handlers.py Sat Jul 16 10:48:33 2011 -0700 @@ -37,7 +37,15 @@ form = "" if 'uploaded' in self.request.GET: form += '
%s uploaded successfully
' % self.request.GET['uploaded'] - form += self.form + '' + form += self.form + if self.app.display_contents: + contents = os.listdir(self.app.directory) + if contents: + contents.sort() + form += '
Currently uploaded:
  • ' + '
  • '.join(contents) + '
' + else: + form += '
No files in upload directory
' + form += '' return Response(content_type='text/html', body=form) class Post(Handler):