9539fb54320e webui

More infrastructure for the web interface.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 13 Oct 2009 19:02:45 -0400
parents 96a4cc60e57d
children 22906da596df
branches/tags webui
files review/web_templates/index.html review/web_ui.py

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/web_templates/index.html	Tue Oct 13 19:02:45 2009 -0400
@@ -0,0 +1,13 @@
+$def with (repo)
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html>
+    <head>
+        <title>Code Review</title>
+    </head>
+    
+    <body>
+        <p>Reviewing: $repo.root</p>
+    </body>
+</html>
\ No newline at end of file
--- a/review/web_ui.py	Tue Oct 13 18:50:22 2009 -0400
+++ b/review/web_ui.py	Tue Oct 13 19:02:45 2009 -0400
@@ -2,7 +2,9 @@
 
 import sys, os
 
-top_path = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
+package_path = os.path.split(os.path.realpath(__file__))[0]
+template_path = os.path.join(package_path, 'web_templates')
+top_path = os.path.split(package_path)[0]
 bundled_path = os.path.join(top_path, 'bundled')
 webpy_path = os.path.join(bundled_path, 'webpy')
 
@@ -10,16 +12,22 @@
 import web
 
 
+_repo = None
 urls = (
     '/', 'index'
 )
+render = web.template.render(template_path)
 
 class index:
     def GET(self):
-        return "Hello, world!"
+        return render.index(_repo)
+    
 
 app = web.application(urls, globals())
 
 def load_interface(repo):
+    global _repo
+    _repo = repo
+    
     sys.argv = sys.argv[:1]    # Seriously, web.py?  This is such a hack.
-    app.run()
\ No newline at end of file
+    app.run()