changeset 1:24b8d06eae53

stub out a simple view
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Feb 2012 15:57:01 -0800
parents 93e830409685
children b03602153de2
files simpypi/factory.py simpypi/templates/index.html
diffstat 2 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/simpypi/factory.py	Mon Feb 27 15:42:12 2012 -0800
+++ b/simpypi/factory.py	Mon Feb 27 15:57:01 2012 -0800
@@ -19,13 +19,12 @@
             return self.fileserver(environ, start_response)
         return self.app(environ, start_response)
 
-def factory(global_conf, **app_conf):
+def factory(**app_conf):
     """create a webob view and wrap it in middleware"""
+    app = Dispatcher(**app_conf)
+    return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static')))
 
-    keystr = 'simpypi.'
-    args = dict([(key.split(keystr, 1)[-1], value)
-                 for key, value in app_conf.items()
-                 if key.startswith(keystr) ])
-    app = Dispatcher(**args)
-    return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static')))
-    
+if __name__ == '__main__':
+    import tempfile
+    from wsgiref import simple_server
+    app = factory
--- a/simpypi/templates/index.html	Mon Feb 27 15:42:12 2012 -0800
+++ b/simpypi/templates/index.html	Mon Feb 27 15:57:01 2012 -0800
@@ -1,22 +1,21 @@
 <!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/"
-      xmlns:xi="http://www.w3.org/2001/XInclude">
+<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<title>Hello world</title>
+<title>Python Package Index</title>
 <script src="${link('jquery.js')}"></script>
-<script type="text/javascript">
-$(document).ready(function(){
-$(".text-input").click(function(){
-$(this).replaceWith('<form method="post"><input type="text" name="name" value="${name}"/><input type="submit" value="Go!"/></form>');
-});
-});
-</script>
 </head>
 <body>
-<xi:include href="navigation.html" />
-Hello <span class="text-input">${name}</span>!
+  <h1>Python Package Index</h1>
+  <span class="date">Last regenerated: </span>
+
+  <!-- upload form -->
+  <form method="post" enctype="multipart/form-data">
+    <label for="package">Upload a package</label>
+    <input type="file" name="package" id="package"/>
+    <input type="submit" value="Upload"/>
+  </form>
+
 </body>
 </html>