From: Date: Sun, 16 Sep 2007 20:55:02 +0000 (-0400) Subject: merged in jinja template move X-Git-Url: https://projects.mako.cc/source/yourule/commitdiff_plain/ee98f53330408fd5f0c0a27720a3dc0d9edced89 merged in jinja template move --- ee98f53330408fd5f0c0a27720a3dc0d9edced89 diff --cc yourule.py index c5ffdb7,9e933d6..3de9e7b --- a/yourule.py +++ b/yourule.py @@@ -6,8 -6,18 +6,18 @@@ import sys, os, r from storm.locals import * from svgruler import SVGRuler + from jinja import Environment, FileSystemLoader + jinja_env = Environment('<%', '%>', '<%=', '%>', '<%#', '%>', + loader=FileSystemLoader('templates/')) + + def render(filename, vars): + web.header("Content-Type","text/html; charset=utf-8") + tmpl = jinja_env.get_template(filename + '.tmpl') + print tmpl.render(vars) + web.debug(web.ctx) + # the url map for the application -urls = ( '/', 'index', +urls = ( '/?', 'index', '/ruler_([0-9\.]+)px_([0-9\.]+)([A-Za-z]+).(svg|png|jpg)', 'ruler_img', '/show/(.*(svg|png|jpg))', 'show_ruler', '/gallery(.*)', 'gallery',