From c5be05113697b9909a438b1861aacd27503028fc Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Tue, 22 Jul 2008 18:11:49 +0000 Subject: [PATCH] /template/render/ --- deluge/ui/webui/pages.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/deluge/ui/webui/pages.py b/deluge/ui/webui/pages.py index 28de44067..2325d7b19 100644 --- a/deluge/ui/webui/pages.py +++ b/deluge/ui/webui/pages.py @@ -390,12 +390,15 @@ class template_static(static_handler): 'templates/%s/static' % config.get('template')) route("/template/static/(.*)", template_static) -class robots: - def GET(self): - "no robots/prevent searchengines from indexing" - web.header("Content-Type", "text/plain") - print "User-agent: *\nDisallow:/\n" -route("/robots.txt", robots) +class render_static: + "render anything in template_dir" + @deco.deluge_page + def GET(self, name): + filename = os.path.join(os.path.dirname(__file__), + 'templates/%s/static/%s' % (config.get('template'), name)) + log.debug("render-static:%s" % filename) + return web.template.Template(open(filename).read(), filename=filename)() +route("/template/render/(.*)", render_static) class template_style: def GET(self): @@ -404,6 +407,13 @@ class template_style: print render.template_style(style) route("/template_style.css", template_style) +class robots: + def GET(self): + "no robots/prevent searchengines from indexing" + web.header("Content-Type", "text/plain") + print "User-agent: *\nDisallow:/\n" +route("/robots.txt", robots) + class pixmaps: "use the deluge-images. located in data/pixmaps" def GET(self, name):