# HG changeset patch # User Jeff Hammel # Date 1341970610 25200 # Node ID aae0a420c4f7dac6be2ac55bd7a3c824590e509e # Parent 76a8d2bd4007dea3dc6520b94ee10512bc152198 should now actually do something diff -r 76a8d2bd4007 -r aae0a420c4f7 talosnames/web.py --- a/talosnames/web.py Tue Jul 10 18:33:15 2012 -0700 +++ b/talosnames/web.py Tue Jul 10 18:36:50 2012 -0700 @@ -4,20 +4,30 @@ web handler for talosnames """ +import os +import tempita from api import TalosNames from webob import Request, Response, exc +here = os.path.dirname(os.path.abspath(__file__)) +template = os.path.join(here, 'templates', 'index.html') + class Handler(object): def __init__(self, **kw): self.api = TalosNames() + self.template = file(template).read() def __call__(self, environ, start_response): request = Request(environ) response = Response(content_type='text/plain', - body="talosnames") + body=self.render()) return response(environ, start_response) + def render(self): + template = tempita.HTMLTemplate(self.template) + return template.substitute({}) + if __name__ == '__main__': from wsgiref import simple_server app = Handler()