[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue 317 by setting the
base when rendering a ZPT Page.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 1 17:32:11 EST 2005
Log message for revision 29374:
Fixed issue 317 by setting the base when rendering a ZPT Page.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/doc/TODO.txt
U Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
U Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
U Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-03-01 22:28:44 UTC (rev 29373)
+++ Zope3/trunk/doc/CHANGES.txt 2005-03-01 22:32:09 UTC (rev 29374)
@@ -495,6 +495,8 @@
Bug Fixes
+ - Fixed issue #317: Relative links don't work in Page Template
+
- Fixed issue #335 (debug layer does not work with Zope3-trunk)
- Fixed issue #338 (zapi help missing from the online help)
Modified: Zope3/trunk/doc/TODO.txt
===================================================================
--- Zope3/trunk/doc/TODO.txt 2005-03-01 22:28:44 UTC (rev 29373)
+++ Zope3/trunk/doc/TODO.txt 2005-03-01 22:32:09 UTC (rev 29374)
@@ -74,14 +74,10 @@
* 316: Zope3X test.py truncates path with dir=
-* 317: Relative links don't work in Page Template
-
* 319: Navigation with anonymous
* 321: TraversalError after renaming or moving Sites with local services
-* 323: Permission zope.Public in addfrom does not work
-
* 332: Death to IContentContainer
* 334: Failing RuntimeInfo tests
Modified: Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py 2005-03-01 22:28:44 UTC (rev 29373)
+++ Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py 2005-03-01 22:32:09 UTC (rev 29374)
@@ -55,35 +55,35 @@
def test_request_base(self):
self.addPage('/pt', u'<head></head>')
self.verify('/pt',
- '<head>\n<base href="http://localhost/pt/index.html" />\n'
+ '<head>\n<base href="http://localhost" />\n'
'</head>\n')
self.verify('/++vh++/++/pt',
- '<head>\n<base href="http://localhost/pt/index.html" />\n'
+ '<head>\n<base href="http://localhost" />\n'
'</head>\n')
self.verify('/++vh++https:otherhost:443/++/pt',
'<head>\n'
- '<base href="https://otherhost/pt/index.html" />'
+ '<base href="https://otherhost" />'
'\n</head>\n')
self.verify('/++vh++https:otherhost:443/fake/folders/++/pt',
'<head>\n<base href='
- '"https://otherhost/fake/folders/pt/index.html" />'
+ '"https://otherhost/fake/folders" />'
'\n</head>\n')
self.addPage('/foo/bar/pt', u'<head></head>')
self.verify('/foo/bar/pt',
'<head>\n<base '
- 'href="http://localhost/foo/bar/pt/index.html" />\n'
+ 'href="http://localhost/foo/bar" />\n'
'</head>\n')
self.verify('/foo/bar/++vh++/++/pt',
- '<head>\n<base href="http://localhost/pt/index.html" />\n'
+ '<head>\n<base href="http://localhost" />\n'
'</head>\n')
self.verify('/foo/bar/++vh++https:otherhost:443/++/pt',
'<head>\n'
- '<base href="https://otherhost/pt/index.html" />'
+ '<base href="https://otherhost" />'
'\n</head>\n')
self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
'<head>\n<base href='
- '"https://otherhost/fake/folders/bar/pt/index.html" />'
+ '"https://otherhost/fake/folders/bar" />'
'\n</head>\n')
def test_request_redirect(self):
Modified: Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/ftests.py 2005-03-01 22:28:44 UTC (rev 29373)
+++ Zope3/trunk/src/zope/app/zptpage/browser/ftests.py 2005-03-01 22:32:09 UTC (rev 29374)
@@ -125,6 +125,7 @@
'/zptpage/@@index.html',
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
+ self.assertEqual(response.getBase(), 'http://localhost')
body = response.getBody()
self.assertEqual(
body,
Modified: Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py 2005-03-01 22:28:44 UTC (rev 29373)
+++ Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py 2005-03-01 22:32:09 UTC (rev 29374)
@@ -25,5 +25,8 @@
request.response.setHeader('content-type',
template.content_type)
+ # Set the base one level lower as usual, so that the ZPT Page is
+ # treated as a file instead of a container.
+ request.response.setBase(request.URL[-2])
return template.render(request, **kw)
More information about the Zope3-Checkins
mailing list