Author: chrisz
Date: Wed Apr 25 11:57:32 2007
New Revision: 6510
Modified:
Webware/trunk/KidKit/Examples/ServletInfo.kid
Webware/trunk/PSP/Examples/PSPTests-Braces.psp
Webware/trunk/PSP/Examples/PSPTests.psp
Webware/trunk/WebKit/Admin/Errors.py
Webware/trunk/WebKit/Examples/RequestInformation.py
Log:
Nicer output in RequestInformation and similar.
Modified: Webware/trunk/KidKit/Examples/ServletInfo.kid
==============================================================================
--- Webware/trunk/KidKit/Examples/ServletInfo.kid (original)
+++ Webware/trunk/KidKit/Examples/ServletInfo.kid Wed Apr 25 11:57:32 2007
@@ -3,6 +3,8 @@
from KidKit.Examples.KidExamplePage import KidExamplePage
hook = KidExamplePage.writeContent
import os
+def show(s):
+ return repr(s).replace(r'\\', '\\').replace(';', '; ').replace(':/', ': /')
?>
<body py:strip="" xmlns:py="http://purl.org/kid/ns#">
<h1>Kid Servlet Info</h1>
@@ -37,12 +39,12 @@
?>
<div py:for="var in vars">
<h4 py:content="var" />
-<p style="font-size:smaller" py:content="repr(eval(var)).replace(';', '; ')" />
+<p style="font-size:small" py:content="show(eval(var))" />
<p py:content="variables[var]" />
</div>
<h2>Environment</h2>
<div py:for="key, value in os.environ.items()">
<h5 py:content="key" />
-<p style="font-size:smaller" py:content="repr(value).replace(';', '; ')" />
+<p style="font-size:small" py:content="show(value)" />
</div>
</body>
\ No newline at end of file
Modified: Webware/trunk/PSP/Examples/PSPTests-Braces.psp
==============================================================================
--- Webware/trunk/PSP/Examples/PSPTests-Braces.psp (original)
+++ Webware/trunk/PSP/Examples/PSPTests-Braces.psp Wed Apr 25 11:57:32 2007
@@ -94,7 +94,8 @@
<table><% for i in self.request()._environ.keys(): {
res.write('<tr valign="top"><td style="color:red;font-size:small">'
+str(i)+' </td><td style="color:blue;font-size:small">'
- +self.request()._environ[i].replace(',', ', ').replace(';', '; ').replace(':', ': ')
+ +self.request()._environ[i].replace(
+ ',', ',<wbr>').replace(';', ';<wbr>').replace(':/', ':<wbr>/')
+'</td></tr>') } %></table>
<hr>
Modified: Webware/trunk/PSP/Examples/PSPTests.psp
==============================================================================
--- Webware/trunk/PSP/Examples/PSPTests.psp (original)
+++ Webware/trunk/PSP/Examples/PSPTests.psp Wed Apr 25 11:57:32 2007
@@ -91,7 +91,8 @@
<table><% for i in self.request()._environ.keys():
res.write('<tr valign="top"><td style="color:red;font-size:small">'
+str(i)+' </td><td style="color:blue;font-size:small">'
- +self.request()._environ[i].replace(',', ', ').replace(';', '; ').replace(':', ': ')
+ +self.request()._environ[i].replace(
+ ',', ',<wbr>').replace(';', ';<wbr>').replace(':/', ':<wbr>/')
+'</td></tr>') %></table>
<hr>
Modified: Webware/trunk/WebKit/Admin/Errors.py
==============================================================================
--- Webware/trunk/WebKit/Admin/Errors.py (original)
+++ Webware/trunk/WebKit/Admin/Errors.py Wed Apr 25 11:57:32 2007
@@ -13,7 +13,17 @@
"""
if self._headings[colIndex] in ('pathname', 'error report filename'):
- return '<a href="file:///%s">%s</a>' % (value, value)
+ path = self.application().serverSidePath()
+ if value.startswith(path):
+ value = value[len(path):]
+ if value.startswith('/'):
+ value = value[1:]
+ link = self.request().uriWebKitRoot() + value
+ value = value.replace('/', '/<wbr>')
+ value = '<a href="%s">%s</a>' % (link, value)
+ else:
+ value = value.replace('/', '/<wbr>')
+ return value
elif self._headings[colIndex] == 'time':
return '<span style="white-space:nowrap">%s</span>' % (value)
else:
Modified: Webware/trunk/WebKit/Examples/RequestInformation.py
==============================================================================
--- Webware/trunk/WebKit/Examples/RequestInformation.py (original)
+++ Webware/trunk/WebKit/Examples/RequestInformation.py Wed Apr 25 11:57:32 2007
@@ -6,15 +6,18 @@
def writeContent(self):
self.writeln('<h3>Request Variables</h3>')
- self.writeln('<p>The following table shows the values for various request variables.</p>')
- self.writeln('<table style="background-color:#EEEEFF;width:100%"'
- ' border="0" cellpadding="2" cellspacing="4" width="100%">')
- self.dict('HTTPRequest.fields()', self.request().fields())
- self.dict('HTTPRequest._environ', self.request()._environ)
- self.dict('Cookies', self.request().cookies())
+ self.writeln('<p>The following table'
+ ' shows the values for various request variables.</p>')
+ self.writeln('<table style="font-size:small;width:100%"'
+ ' border="0" cellpadding="2" cellspacing="2" width="100%">')
+ request = self.request()
+ self.dict('fields()', request.fields())
+ self.dict('environ()', request.environ())
+ self.dict('cookies()', request.cookies())
self.writeln('</table>')
- self.response().setCookie('TestCookieName', 'CookieValue')
- self.response().setCookie('TestExpire1', 'Expires in 1 minutes', expires='+1m')
+ setCookie = self.response().setCookie
+ setCookie('TestCookieName', 'CookieValue')
+ setCookie('TestExpire1', 'expires in 1 minute', expires='+1m')
def pair(self, key, value):
valueType = type(value)
@@ -30,11 +33,12 @@
def dict(self, name, dict):
self.writeln('<tr valign="top">'
- '<td style="background-color:#CCCCFF" colspan="2">%s</td>'
+ '<td style="background-color:#CCF" colspan="2">%s</td>'
'</tr>' % (name))
keys = dict.keys()
keys.sort()
for name in keys:
- self.writeln('<tr valign="top"><td>%s</td><td>%s</td></tr>' % (name,
- self.htmlEncode(str(dict[name])).replace(
- '\n', '<br>').replace(',', ', ').replace(';', '; ')))
+ self.writeln('<tr valign="top" style="background-color:#EEF">'
+ '<td>%s</td><td>%s</td></tr>' % (name, self.htmlEncode(
+ str(dict[name])).replace('\n', '<br>').replace(
+ ',', ',<wbr>').replace(';', ';<wbr>').replace(':/', ':<wbr>/')))
|