瀏覽代碼

Format cookies encoding JSON nicely.

pull/24/head
Ben Kurtovic 12 年之前
父節點
當前提交
13d140d899
共有 2 個檔案被更改,包括 16 行新增1 行删除
  1. +12
    -1
      pages/settings.mako
  2. +4
    -0
      static/css/main.css

+ 12
- 1
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:
<div class="green-box">${status}</div>
@@ -51,7 +52,17 @@
% for cookie in cookies.itervalues():
<tr>
<td><b><tt>${cookie.key | h}</tt></b></td>
<td><tt>${cookie.value | h}</tt></td>
% try:
<% lines = dumps(loads(cookie.value), indent=4).splitlines() %>
% except ValueError:
<td><tt>${cookie.value | h}</tt></td>
% else:
<td>
% for line in lines:
<tt><div class="indentable">${line | h}</div></tt>
% endfor
</td>
% endtry
<td>
<form action="${environ['PATH_INFO']}" method="post">
<input type="hidden" name="action" value="delete">


+ 4
- 0
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;


Loading…
取消
儲存