Commits

Dan Boitnott committed e1c6d2c

Small change to templates

  • Participants
  • Parent commits 7daf116

Comments (0)

Files changed (5)

File src/resources/templates/index.html.mustache

-<!DOCTYPE html>
-<html>
-    <head>
-        <title>PRISE - {{request.server_name}}</title>
-    </head>
-    <body>
-        <h1>PRISE - {{request.server_name}}</h1>
-    </body>
-</html>

File src/resources/templates/index.mustache

+{{>stdhead}}
+
+<h1>PRISE - {{request.server_name}}</h1>
+
+{{>stdfoot}}

File src/resources/templates/stdfoot.mustache

+</body>
+</html>

File src/resources/templates/stdhead.mustache

+<!DOCTYPE html>
+<html>
+<head>
+    <title>PRISE - {{request.server_name}}</title>
+</head>
+<body>
             shutil.copyfileobj(fp, self.wfile)
 
     def sendTemplate(self, templateName, contentType = "text/html", **args):
-        args["request"] = {
-            "server_name": socket.gethostname()
+        context = {
+            "request": {
+                "server_name": socket.gethostname()
+            }
         }
 
-        print args
-
-        content = self.renderer.render_name(templateName, args)
+        content = self.renderer.render_name(templateName, context, args)
         self.send_response(200)
         self.send_header("Content-type", contentType)
         self.send_header("Content-Length", str(len(content)))
         self.wfile.write("1")
 
     def cmd_index(self, path, query):
-        self.sendTemplate("index.html")
+        self.sendTemplate("index")
 
 if __name__ == '__main__':
     server = BaseHTTPServer.HTTPServer(('127.0.0.1', 8088), Handler)