From 13d140d899f25fe1f4be8988d298f3ef77ef13ef Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 24 Jul 2012 22:32:12 -0400 Subject: [PATCH] Format cookies encoding JSON nicely. --- pages/settings.mako | 13 ++++++++++++- static/css/main.css | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pages/settings.mako b/pages/settings.mako index 785c817..fa0b94f 100644 --- a/pages/settings.mako +++ b/pages/settings.mako @@ -1,5 +1,6 @@ <%include file="/support/header.mako" args="environ=environ, title='Settings'"/>\ <%namespace module="toolserver.settings" import="main"/>\ +<%! from json import dumps, loads %> <% bot, cookies, status, langs, projects = main(environ, headers) %> % if status:
${status}
@@ -51,7 +52,17 @@ % for cookie in cookies.itervalues(): ${cookie.key | h} - ${cookie.value | h} + % try: + <% lines = dumps(loads(cookie.value), indent=4).splitlines() %> + % except ValueError: + ${cookie.value | h} + % else: + + % for line in lines: +
${line | h}
+ % endfor + + % endtry
diff --git a/static/css/main.css b/static/css/main.css index a2e9097..670aba8 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -92,6 +92,10 @@ div.red-box { border: 1px solid #7F7; } +div.indentable { + white-space: pre-wrap; +} + p.toolname { font-size: 18px; margin: 6px 0 6px 0;