From: Quentin Smith
Date: Mon, 28 Sep 2009 07:04:32 +0000 (-0400)
Subject: Unauthenticated front page
X-Git-Tag: 0.1.0^2~43
X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/618e384daea47ffcacee824c36a041f4a38f4ea5?hp=426183788de4f8f68adce1a03860294cf446bcf1
Unauthenticated front page
svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2692
---
diff --git a/code/main.fcgi b/code/main.fcgi
index cd10538..6f3ed99 100755
--- a/code/main.fcgi
+++ b/code/main.fcgi
@@ -4,7 +4,7 @@
import cherrypy
import os
import sys
-from main import InvirtWeb
+from main import InvirtWeb, InvirtUnauthWeb
dev = False
base_dir = os.path.dirname(__file__)
@@ -25,6 +25,10 @@ if __name__=="__main__":
'tools.staticdir.dir': static_dir}
})
app.merge(conf_file)
+ unauthApp = cherrypy.tree.mount(InvirtUnauthWeb(),
+ '/unauth',
+ {'/': {'tools.invirtwebstate.on': True}})
+ unauthApp.merge(conf_file)
cherrypy.config.update(conf_file)
if dev:
@@ -34,5 +38,5 @@ if __name__=="__main__":
else:
cherrypy.engine.start(blocking=False)
from flup.server.fcgi import WSGIServer
- server = WSGIServer(app)
+ server = WSGIServer(cherrypy.tree)
server.run()
diff --git a/code/main.py b/code/main.py
index baf4ff9..361fbbd 100755
--- a/code/main.py
+++ b/code/main.py
@@ -47,6 +47,12 @@ from invirt.common import InvalidInput, CodeError
from view import View
+class InvirtUnauthWeb(View):
+ @cherrypy.expose
+ @cherrypy.tools.mako(filename="/unauth.mako")
+ def index(self):
+ return {'simple': True}
+
class InvirtWeb(View):
def __init__(self):
super(self.__class__,self).__init__()
@@ -654,13 +660,7 @@ def infoDict(username, state, machine):
fields = fields)
return d
-def unauthFront(_, _2, _3, fields):
- """Information for unauth'd users."""
- return templates.unauth(searchList=[{'simple' : True,
- 'hostname' : socket.getfqdn()}])
-
-mapping = dict(
- unauth=unauthFront)
+mapping = dict()
def printHeaders(headers):
"""Print a dictionary as HTTP headers."""
diff --git a/code/templates/unauth.tmpl b/code/templates/unauth.mako
similarity index 90%
rename from code/templates/unauth.tmpl
rename to code/templates/unauth.mako
index 0715f2c..562481f 100644
--- a/code/templates/unauth.tmpl
+++ b/code/templates/unauth.mako
@@ -1,12 +1,10 @@
-#from skeleton import skeleton
-#extends skeleton
+<%page expression_filter="h"/>
+<%inherit file="skeleton.mako" />
-
-#def title
+<%def name="title()">
Intro
-#end def
+%def>
-#def body
XVM — Virtual Servers for MIT
xvm.mit.edu is a virtualization service for the
@@ -18,7 +16,7 @@ to any Athena account holder.
MIT users:
→ Log in to XVM now
+href="https://${config.web.hostname}/">→ Log in to XVM now
You'll need an MIT personal
certificate.
@@ -56,5 +54,3 @@ contributors.
Questions and feedback welcome at xvm@mit.edu.
-
-#end def