[pypy-svn] r40533 - in pypy/dist/pypy/tool/build: . web web/templates

guido at codespeak.net guido at codespeak.net
Thu Mar 15 15:04:50 CET 2007


Author: guido
Date: Thu Mar 15 15:04:49 2007
New Revision: 40533

Added:
   pypy/dist/pypy/tool/build/web/templates/nav.html
Modified:
   pypy/dist/pypy/tool/build/config.py
   pypy/dist/pypy/tool/build/web/app.py
   pypy/dist/pypy/tool/build/web/templates/build.html
   pypy/dist/pypy/tool/build/web/templates/buildersinfo.html
   pypy/dist/pypy/tool/build/web/templates/builds.html
   pypy/dist/pypy/tool/build/web/templates/index.html
   pypy/dist/pypy/tool/build/web/templates/metaserverstatus.html
Log:
All templates get a default set of values passed to them now, including one
called 'vhostroot' that can be used for fixing links in (simple) virtual
hosting situations, and 'nav' that contains the navigation. This navigation
is now shared by all views, and uses a seperate template.


Modified: pypy/dist/pypy/tool/build/config.py
==============================================================================
--- pypy/dist/pypy/tool/build/config.py	(original)
+++ pypy/dist/pypy/tool/build/config.py	Thu Mar 15 15:04:49 2007
@@ -4,12 +4,15 @@
 
 # general settings, used by both server and client
 server = 'codespeak.net'
-webserver = ''
 port = 12321
 testport = 32123
-webport = 8080
 path = [str(packageparent)]
 
+# options for webserver
+webserver = ''
+vhostroot = ''
+webport = 8080
+
 # configuration of options for client and startcompile
 from pypy.config.config import Config
 

Modified: pypy/dist/pypy/tool/build/web/app.py
==============================================================================
--- pypy/dist/pypy/tool/build/web/app.py	(original)
+++ pypy/dist/pypy/tool/build/web/app.py	Thu Mar 15 15:04:49 2007
@@ -19,6 +19,17 @@
             '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n%s' % (
             html.strip().encode('UTF-8'),))
 
+def get_nav(context):
+    template = templesser.template(mypath.join('templates/nav.html').read())
+    return template.unicode(context)
+
+def get_base_context():
+    context = {
+        'vhostroot': config.vhostroot,
+    }
+    context['nav'] = get_nav(context)
+    return context
+
 def format_time(t):
     if t is None:
         return None
@@ -184,7 +195,9 @@
     def __call__(self, handler, path, query):
         template = templesser.template(
             mypath.join('templates/metaserverstatus.html').read())
-        return (get_headers(), fix_html(template.unicode(self.get_status())))
+        context = get_base_context()
+        context.update(self.get_status())
+        return (get_headers(), fix_html(template.unicode(context)))
 
     def get_status(self):
         return self.call_method('status')
@@ -193,8 +206,9 @@
     def __call__(self, handler, path, query):
         template = templesser.template(
             mypath.join('templates/buildersinfo.html').read())
-        return (get_headers(), fix_html(template.unicode(
-                                  {'builders': self.get_buildersinfo()})))
+        context = get_base_context()
+        context.update({'builders': self.get_buildersinfo()})
+        return (get_headers(), fix_html(template.unicode(context)))
 
     def get_buildersinfo(self):
         infos = self.call_method('buildersinfo')
@@ -231,8 +245,9 @@
     def __call__(self, handler, path, query):
         template = templesser.template(
             mypath.join('templates/build.html').read())
-        return (get_headers(),
-                fix_html(template.unicode(self.get_info())))
+        context = get_base_context()
+        context.update(self.get_info())
+        return (get_headers(), fix_html(template.unicode(context)))
 
     def get_info(self):
         bpinfo, brstr = self.call_method('buildrequest', (self._buildid,))
@@ -262,8 +277,9 @@
     def __call__(self, handler, path, query):
         template = templesser.template(
             mypath.join('templates/builds.html').read())
-        return (get_headers(),
-                fix_html(template.unicode({'builds': self.get_builds()})))
+        context = get_base_context()
+        context.update({'builds': self.get_builds()})
+        return (get_headers(), fix_html(template.unicode(context)))
 
     def get_builds(self):
         data = [(i, BuildRequest.fromstring(b)) for(i, b) in
@@ -314,8 +330,7 @@
     def index(self, handler, path, query):
         template = templesser.template(
             mypath.join('templates/index.html').read())
-        return (get_headers(),
-                fix_html(template.unicode({})))
+        return (get_headers(), fix_html(template.unicode(get_base_context())))
     index.exposed = True
 
 class AppHandler(Handler):

Modified: pypy/dist/pypy/tool/build/web/templates/build.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/build.html	(original)
+++ pypy/dist/pypy/tool/build/web/templates/build.html	Thu Mar 15 15:04:49 2007
@@ -1,14 +1,10 @@
 <html>
   <head>
     <title>Build meta server build %(id)s</title>
-    <link rel="stylesheet" type="text/css" href="/style" />
+    <link rel="stylesheet" type="text/css" href="%(vhostroot)s/style" />
   </head>
   <body>
-    <ul class="sidebar">
-      <li><a href="/metaserverstatus">meta server status</a></li>
-      <li><a href="/buildersinfo">connected build servers</a></li>
-      <li><a href="/builds">builds (both in-progress and done)</a></li>
-    </ul>
+    %(nav)s
     <h2>Build %(id)s</h2>
     <div class="infoblock">
       %(url)[c

Modified: pypy/dist/pypy/tool/build/web/templates/buildersinfo.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/buildersinfo.html	(original)
+++ pypy/dist/pypy/tool/build/web/templates/buildersinfo.html	Thu Mar 15 15:04:49 2007
@@ -1,14 +1,10 @@
 <html>
   <head>
     <title>Build meta server builders page</title>
-    <link rel="stylesheet" type="text/css" href="/style" />
+    <link rel="stylesheet" type="text/css" href="%(vhostroot)s/style" />
   </head>
   <body>
-    <ul class="sidebar">
-      <li><a href="/metaserverstatus">meta server status</a></li>
-      <li><a href="/buildersinfo">connected build servers</a></li>
-      <li><a href="/builds">builds (both in-progress and done)</a></li>
-    </ul>
+    %(nav)s
     <h2>Connected build servers</h2>
     <div class="builders">
       %(builders)[b

Modified: pypy/dist/pypy/tool/build/web/templates/builds.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/builds.html	(original)
+++ pypy/dist/pypy/tool/build/web/templates/builds.html	Thu Mar 15 15:04:49 2007
@@ -1,14 +1,10 @@
 <html>
   <head>
     <title>Build meta server builds page</title>
-    <link rel="stylesheet" type="text/css" href="/style" />
+    <link rel="stylesheet" type="text/css" href="%(vhostroot)s/style" />
   </head>
   <body>
-    <ul class="sidebar">
-      <li><a href="/metaserverstatus">meta server status</a></li>
-      <li><a href="/buildersinfo">connected build servers</a></li>
-      <li><a href="/builds">builds (both in-progress and done)</a></li>
-    </ul>
+    %(nav)s
     <h2>Overview of builds</h2>
     <p>
       Here you see an overview of all builds, both completed (and available

Modified: pypy/dist/pypy/tool/build/web/templates/index.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/index.html	(original)
+++ pypy/dist/pypy/tool/build/web/templates/index.html	Thu Mar 15 15:04:49 2007
@@ -1,14 +1,10 @@
 <html>
   <head>
     <title>Build meta server web interface (temp index page)</title>
-    <link rel="stylesheet" type="text/css" href="/style" />
+    <link rel="stylesheet" type="text/css" href="%(vhostroot)s/style" />
   </head>
   <body>
-    <ul class="sidebar">
-      <li><a href="/metaserverstatus">meta server status</a></li>
-      <li><a href="/buildersinfo">connected build servers</a></li>
-      <li><a href="/builds">builds (both in-progress and done)</a></li>
-    </ul>
+    %(nav)s
   </body>
 </html>
 

Modified: pypy/dist/pypy/tool/build/web/templates/metaserverstatus.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/metaserverstatus.html	(original)
+++ pypy/dist/pypy/tool/build/web/templates/metaserverstatus.html	Thu Mar 15 15:04:49 2007
@@ -1,14 +1,10 @@
 <html>
   <head>
     <title>Build meta server status page</title>
-    <link rel="stylesheet" type="text/css" href="/style" />
+    <link rel="stylesheet" type="text/css" href="%(vhostroot)s/style" />
   </head>
   <body>
-    <ul class="sidebar">
-      <li><a href="/metaserverstatus">meta server status</a></li>
-      <li><a href="/buildersinfo">connected build servers</a></li>
-      <li><a href="/builds">builds (both in-progress and done)</a></li>
-    </ul>
+    %(nav)s
     <h2>Server status</h2>
     <ul>
       <li>Connected build servers: %(builders)s</li>

Added: pypy/dist/pypy/tool/build/web/templates/nav.html
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/tool/build/web/templates/nav.html	Thu Mar 15 15:04:49 2007
@@ -0,0 +1,6 @@
+<ul class="sidebar">
+  <li><a href="%(vhostroot)s/metaserverstatus">meta server status</a></li>
+  <li><a href="%(vhostroot)s/buildersinfo">connected build servers</a></li>
+  <li><a href="%(vhostroot)s/builds">builds (both in-progress and done)</a></li>
+</ul>
+



More information about the Pypy-commit mailing list