[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Moved the marker interface for content to be published as pages to a

Jim Fulton jim at zope.com
Tue Mar 15 10:37:18 EST 2005


Log message for revision 29475:
  Moved the marker interface for content to be published as pages to a
  sane location.  Also changed zpt pages to use the marker interface.
  The point of this is to allow content like this to properly compute
  their base href for any links they display.
  

Changed:
  U   Zope3/trunk/src/zope/app/authentication/authenticationplugins.zcml
  U   Zope3/trunk/src/zope/app/configure.zcml
  U   Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py
  U   Zope3/trunk/src/zope/app/dtmlpage/ftests.py
  A   Zope3/trunk/src/zope/app/dtmlpage/url.txt
  U   Zope3/trunk/src/zope/app/file/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/file/browser/ftests.py
  A   Zope3/trunk/src/zope/app/file/browser/url.txt
  U   Zope3/trunk/src/zope/app/file/file.py
  U   Zope3/trunk/src/zope/app/file/interfaces.py
  U   Zope3/trunk/src/zope/app/onlinehelp/interfaces.py
  A   Zope3/trunk/src/zope/app/publication/configure.zcml
  U   Zope3/trunk/src/zope/app/publication/interfaces.py
  U   Zope3/trunk/src/zope/app/sqlscript/configure.zcml
  U   Zope3/trunk/src/zope/app/sqlscript/sqlscript.py
  U   Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
  U   Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
  A   Zope3/trunk/src/zope/app/zptpage/browser/url.txt
  U   Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
  U   Zope3/trunk/src/zope/app/zptpage/zptpage.py
  U   Zope3/trunk/src/zope/publisher/browser.py

-=-
Modified: Zope3/trunk/src/zope/app/authentication/authenticationplugins.zcml
===================================================================
--- Zope3/trunk/src/zope/app/authentication/authenticationplugins.zcml	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/authentication/authenticationplugins.zcml	2005-03-15 15:37:18 UTC (rev 29475)
@@ -39,10 +39,6 @@
         />
     <require
         permission="zope.ManageContent"
-        interface="zope.app.file.interfaces.IFileContent"
-        />
-    <require
-        permission="zope.ManageContent"
         interface=".interfaces.IAuthenticationPlugin" />
 
   </localUtility>

Modified: Zope3/trunk/src/zope/app/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/configure.zcml	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/configure.zcml	2005-03-15 15:37:18 UTC (rev 29475)
@@ -31,6 +31,7 @@
   <include package="zope.app.container" />
 
   <include package="zope.app.publisher" />
+  <include package="zope.app.publication" />
   <include package="zope.app.traversing" />
   <include package="zope.app.pagetemplate" />
   <include package=".generations" />

Modified: Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/dtmlpage/dtmlpage.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -26,7 +26,7 @@
 from zope.app.filerepresentation.interfaces import IFileFactory
 from zope.app.container.contained import Contained
 
-from zope.app.file.interfaces import IFileContent
+from zope.app.publication.interfaces import IFileContent
 from interfaces import IDTMLPage, IRenderDTMLPage
 
 class DTMLPage(Persistent, Contained):

Modified: Zope3/trunk/src/zope/app/dtmlpage/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/ftests.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/dtmlpage/ftests.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -111,9 +111,12 @@
 
 
 def test_suite():
+    from zope.app.tests import functional
     return unittest.TestSuite((
         unittest.makeSuite(DTMLPageTest),
+        functional.FunctionalDocFileSuite('url.txt'),
         ))
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
+

Added: Zope3/trunk/src/zope/app/dtmlpage/url.txt
===================================================================
--- Zope3/trunk/src/zope/app/dtmlpage/url.txt	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/dtmlpage/url.txt	2005-03-15 15:37:18 UTC (rev 29475)
@@ -0,0 +1,68 @@
+Special URL handling for DTML pages
+===================================
+
+When a DTML page containing a head tag is visited, without a trailing
+slash, the base href isn't set.  When visited with a slash, it is:
+
+
+  >>> print http(r"""
+  ... POST /+/zope.app.dtmlpage.DTMLPage%3D HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Length: 497
+  ... Content-Type: multipart/form-data; boundary=---------------------------824954900632940947241835499
+  ... Referer: http://localhost:8081/+/zope.app.dtmlpage.DTMLPage%3D
+  ... 
+  ... -----------------------------824954900632940947241835499
+  ... Content-Disposition: form-data; name="field.source"
+  ... 
+  ... <html>
+  ... <head></head>
+  ... <body>
+  ... <a href="eek.html">Eek</a>
+  ... </body>
+  ... </html>
+  ... 
+  ... -----------------------------824954900632940947241835499
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------824954900632940947241835499
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... dtml.html
+  ... -----------------------------824954900632940947241835499--
+  ... """)
+  HTTP/1.1 303 See Other
+  ...
+
+
+  >>> print http(r"""
+  ... GET /dtml.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head></head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+  <BLANKLINE>
+
+
+  >>> print http(r"""
+  ... GET /dtml.html/ HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head>
+  <base href="http://localhost/dtml.html" />
+  </head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+  <BLANKLINE>

Modified: Zope3/trunk/src/zope/app/file/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/configure.zcml	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/file/browser/configure.zcml	2005-03-15 15:37:18 UTC (rev 29475)
@@ -5,13 +5,6 @@
     >
 
   <!-- directives for File -->
-
-  <browser:view
-      for="zope.app.file.interfaces.IFileContent"
-      provides="zope.publisher.interfaces.browser.IBrowserPublisher"
-      class="zope.app.publication.traversers.FileContentTraverser"
-      permission="zope.Public"
-      />
   
   <browser:editform
       name="edit.html"

Modified: Zope3/trunk/src/zope/app/file/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/ftests.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/file/browser/ftests.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -240,11 +240,12 @@
         self.assert_('<iframe src="."' in body)
         self.checkForBrokenLinks(body, '/image/@@preview.html', 'mgr:mgrpw')
 
-
 def test_suite():
+    from zope.app.tests import functional
     return unittest.TestSuite((
         unittest.makeSuite(FileTest),
         unittest.makeSuite(ImageTest),
+        functional.FunctionalDocFileSuite('url.txt'),
         ))
 
 if __name__ == '__main__':

Added: Zope3/trunk/src/zope/app/file/browser/url.txt
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/url.txt	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/file/browser/url.txt	2005-03-15 15:37:18 UTC (rev 29475)
@@ -0,0 +1,95 @@
+Special URL handling for DTML pages
+===================================
+
+When an HTML File page containing a head tag is visited, without a
+trailing slash, the base href isn't set.  When visited with a slash,
+it is:
+
+
+  >>> print http(r"""
+  ... POST /+/zope.app.file.File%3D HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Length: 610
+  ... Content-Type: multipart/form-data; boundary=---------------------------32826232819858510771857533856
+  ... Referer: http://localhost:8081/+/zope.app.file.File=
+  ... 
+  ... -----------------------------32826232819858510771857533856
+  ... Content-Disposition: form-data; name="field.contentType"
+  ... 
+  ... text/html
+  ... -----------------------------32826232819858510771857533856
+  ... Content-Disposition: form-data; name="field.data"; filename=""
+  ... Content-Type: application/octet-stream
+  ... 
+  ... 
+  ... -----------------------------32826232819858510771857533856
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------32826232819858510771857533856
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... file.html
+  ... -----------------------------32826232819858510771857533856--
+  ... """)
+  HTTP/1.1 303 See Other
+  ...
+
+  >>> print http(r"""
+  ... POST /file.html/edit.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Length: 507
+  ... Content-Type: multipart/form-data; boundary=---------------------------10196264131256436092131136054
+  ... Referer: http://localhost:8081/file.html/edit.html
+  ... 
+  ... -----------------------------10196264131256436092131136054
+  ... Content-Disposition: form-data; name="field.contentType"
+  ... 
+  ... text/html
+  ... -----------------------------10196264131256436092131136054
+  ... Content-Disposition: form-data; name="field.data"
+  ... 
+  ... <html>
+  ... <head></head>
+  ... <body>
+  ... <a href="eek.html">Eek</a>
+  ... </body>
+  ... </html>
+  ... -----------------------------10196264131256436092131136054
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Change
+  ... -----------------------------10196264131256436092131136054--
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+
+  >>> print http(r"""
+  ... GET /file.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head></head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+
+
+  >>> print http(r"""
+  ... GET /file.html/ HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head>
+  <base href="http://localhost/file.html" />
+  </head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+

Modified: Zope3/trunk/src/zope/app/file/file.py
===================================================================
--- Zope3/trunk/src/zope/app/file/file.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/file/file.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -20,9 +20,9 @@
 from persistent import Persistent
 from transaction import get_transaction
 from zope.interface import implements
+import zope.app.publication.interfaces
+from zope.app.file import interfaces
 
-from interfaces import IFile, IFileContent
-
 # set the size of the chunks
 MAXCHUNKSIZE = 1 << 16
 
@@ -110,13 +110,13 @@
     Last, but not least, verify the interface:
 
     >>> from zope.interface.verify import verifyClass
-    >>> IFile.implementedBy(File)
+    >>> interfaces.IFile.implementedBy(File)
     True
-    >>> verifyClass(IFile, File)
+    >>> verifyClass(interfaces.IFile, File)
     True
     """
     
-    implements(IFileContent, IFile)
+    implements(zope.app.publication.interfaces.IFileContent, interfaces.IFile)
 
     def __init__(self, data='', contentType=''):
         self.data = data

Modified: Zope3/trunk/src/zope/app/file/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/file/interfaces.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/file/interfaces.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -42,16 +42,6 @@
     def getSize():
         """Return the byte-size of the data of the object."""
 
-
-class IFileContent(Interface):
-    """Marker interface for content that can be managed as files.
-
-    The default view for file content has effective URLs that don't end in
-    /.  In particular, if the content included HTML, relative links in
-    the HTML are relative to the container the content is in.
-    """
-
-
 class IImage(IFile):
     """This interface defines an Image that can be displayed.
     """

Modified: Zope3/trunk/src/zope/app/onlinehelp/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/onlinehelp/interfaces.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/onlinehelp/interfaces.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -22,7 +22,8 @@
 from zope.schema import TextLine, SourceText, Choice
 from zope.configuration.fields import GlobalInterface
 from zope.app.container.interfaces import IContainer
-from zope.app.file.interfaces import IFile, IFileContent
+from zope.app.publication.interfaces import IFileContent
+from zope.app.file.interfaces import IFile
 from zope.app.i18n import ZopeMessageIDFactory as _ 
 
 class IOnlineHelpTopic(IContainer):

Added: Zope3/trunk/src/zope/app/publication/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/publication/configure.zcml	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/publication/configure.zcml	2005-03-15 15:37:18 UTC (rev 29475)
@@ -0,0 +1,13 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    >
+
+  <browser:view
+      for="zope.app.publication.interfaces.IFileContent"
+      provides="zope.publisher.interfaces.browser.IBrowserPublisher"
+      class="zope.app.publication.traversers.FileContentTraverser"
+      permission="zope.Public"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/publication/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/publication/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/interfaces.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/publication/interfaces.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -64,4 +64,10 @@
     def __call__(input_stream, output_steam, env):
         """Create a request object to handle SOAP input."""
 
+class IFileContent(interface.Interface):
+    """Marker interface for content that can be managed as files.
 
+    The default view for file content has effective URLs that don't end in
+    /.  In particular, if the content included HTML, relative links in
+    the HTML are relative to the container the content is in.
+    """

Modified: Zope3/trunk/src/zope/app/sqlscript/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/configure.zcml	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/sqlscript/configure.zcml	2005-03-15 15:37:18 UTC (rev 29475)
@@ -30,10 +30,6 @@
         interface=".interfaces.ISQLScript"
         set_schema=".interfaces.ISQLScript"
         />
-    <require
-        permission="zope.ManageContent"
-        interface="zope.app.file.interfaces.IFileContent"
-        />
     <implements
         interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
         />

Modified: Zope3/trunk/src/zope/app/sqlscript/sqlscript.py
===================================================================
--- Zope3/trunk/src/zope/app/sqlscript/sqlscript.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/sqlscript/sqlscript.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -29,7 +29,6 @@
 from zope.app.container.contained import Contained
 from zope.app.cache.caching import getCacheForObject, getLocationForCache
 from zope.app.rdb.interfaces import IZopeDatabaseAdapter
-from zope.app.file.interfaces import IFileContent
 
 from interfaces import ISQLScript
 from dtml import SQLDTML
@@ -50,7 +49,7 @@
 
 
 class SQLScript(Persistent, Contained):
-    implements(ISQLScript, IFileContent)
+    implements(ISQLScript)
 
     def __init__(self, connectionName='', source='', arguments=''):
         self.template = SQLDTML(source)

Modified: Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/traversing/ftests/test_vhosting.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -35,55 +35,55 @@
 
     def test_request_url(self):
         self.addPage('/pt', u'<span tal:replace="request/URL"/>')
-        self.verify('/pt', 'http://localhost/pt/index.html\n')
+        self.verify('/pt', 'http://localhost/pt\n')
         self.verify('/++vh++/++/pt',
-                    'http://localhost/pt/index.html\n')
+                    'http://localhost/pt\n')
         self.verify('/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt/index.html\n')
+                    'https://otherhost/pt\n')
         self.verify('/++vh++https:otherhost:443/fake/folders/++/pt',
-                    'https://otherhost/fake/folders/pt/index.html\n')
+                    'https://otherhost/fake/folders/pt\n')
 
         self.addPage('/foo/bar/pt', u'<span tal:replace="request/URL"/>')
-        self.verify('/foo/bar/pt', 'http://localhost/foo/bar/pt/index.html\n')
+        self.verify('/foo/bar/pt', 'http://localhost/foo/bar/pt\n')
         self.verify('/foo/bar/++vh++/++/pt',
-                    'http://localhost/pt/index.html\n')
+                    'http://localhost/pt\n')
         self.verify('/foo/bar/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt/index.html\n')
+                    'https://otherhost/pt\n')
         self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
-                    'https://otherhost/fake/folders/bar/pt/index.html\n')
+                    'https://otherhost/fake/folders/bar/pt\n')
 
     def test_request_base(self):
         self.addPage('/pt', u'<head></head>')
-        self.verify('/pt',
-                    '<head>\n<base href="http://localhost" />\n'
+        self.verify('/pt/',
+                    '<head>\n<base href="http://localhost/pt" />\n'
                     '</head>\n')
-        self.verify('/++vh++/++/pt',
-                    '<head>\n<base href="http://localhost" />\n'
+        self.verify('/++vh++/++/pt/',
+                    '<head>\n<base href="http://localhost/pt" />\n'
                     '</head>\n')
-        self.verify('/++vh++https:otherhost:443/++/pt',
+        self.verify('/++vh++https:otherhost:443/++/pt/',
                     '<head>\n'
-                    '<base href="https://otherhost" />'
+                    '<base href="https://otherhost/pt" />'
                     '\n</head>\n')
-        self.verify('/++vh++https:otherhost:443/fake/folders/++/pt',
+        self.verify('/++vh++https:otherhost:443/fake/folders/++/pt/',
                     '<head>\n<base href='
-                    '"https://otherhost/fake/folders" />'
+                    '"https://otherhost/fake/folders/pt" />'
                     '\n</head>\n')
 
         self.addPage('/foo/bar/pt', u'<head></head>')
-        self.verify('/foo/bar/pt',
+        self.verify('/foo/bar/pt/',
                     '<head>\n<base '
-                    'href="http://localhost/foo/bar" />\n'
+                    'href="http://localhost/foo/bar/pt" />\n'
                     '</head>\n')
-        self.verify('/foo/bar/++vh++/++/pt',
-                    '<head>\n<base href="http://localhost" />\n'
+        self.verify('/foo/bar/++vh++/++/pt/',
+                    '<head>\n<base href="http://localhost/pt" />\n'
                     '</head>\n')
-        self.verify('/foo/bar/++vh++https:otherhost:443/++/pt',
+        self.verify('/foo/bar/++vh++https:otherhost:443/++/pt/',
                     '<head>\n'
-                    '<base href="https://otherhost" />'
+                    '<base href="https://otherhost/pt" />'
                     '\n</head>\n')
-        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
+        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt/',
                     '<head>\n<base href='
-                    '"https://otherhost/fake/folders/bar" />'
+                    '"https://otherhost/fake/folders/bar/pt" />'
                     '\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-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/zptpage/browser/ftests.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -125,7 +125,7 @@
             '/zptpage/@@index.html',
             basic='mgr:mgrpw')
         self.assertEqual(response.getStatus(), 200)
-        self.assertEqual(response.getBase(), 'http://localhost')
+        self.assertEqual(response.getBase(), '')
         body = response.getBody()
         self.assertEqual(
             body,
@@ -179,6 +179,7 @@
     return unittest.TestSuite((
         unittest.makeSuite(ZPTPageTest),
         FunctionalDocFileSuite('collector266.txt', 'collector269.txt'),
+        FunctionalDocFileSuite('url.txt'),
         ))
 
 if __name__ == '__main__':

Added: Zope3/trunk/src/zope/app/zptpage/browser/url.txt
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/url.txt	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/zptpage/browser/url.txt	2005-03-15 15:37:18 UTC (rev 29475)
@@ -0,0 +1,73 @@
+Special URL handling for DTML pages
+===================================
+
+When a ZPT page containing a head tag is visited, without a trailing
+slash, the base href isn't set.  When visited with a slash, it is:
+
+  >>> print http(r"""
+  ... POST /+/zope.app.zptpage.ZPTPage%3D HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Length: 764
+  ... Content-Type: multipart/form-data; boundary=---------------------------178869070917677183891223841261
+  ... Referer: http://localhost:8081/+/zope.app.zptpage.ZPTPage=
+  ... 
+  ... -----------------------------178869070917677183891223841261
+  ... Content-Disposition: form-data; name="field.source"
+  ... 
+  ... <html>
+  ... <head></head>
+  ... <body>
+  ... <a href="eek.html">Eek</a>
+  ... </body>
+  ... </html>
+  ... -----------------------------178869070917677183891223841261
+  ... Content-Disposition: form-data; name="field.expand.used"
+  ... 
+  ... 
+  ... -----------------------------178869070917677183891223841261
+  ... Content-Disposition: form-data; name="field.evaluateInlineCode.used"
+  ... 
+  ... 
+  ... -----------------------------178869070917677183891223841261
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------178869070917677183891223841261
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... zpt.html
+  ... -----------------------------178869070917677183891223841261--
+  ... """)
+  HTTP/1.1 303 See Other
+  ...
+
+  >>> print http(r"""
+  ... GET /zpt.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head></head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+  <BLANKLINE>
+
+
+  >>> print http(r"""
+  ... GET /zpt.html/ HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+  <html>
+  <head>
+  <base href="http://localhost/zpt.html" />
+  </head>
+  <body>
+  <a href="eek.html">Eek</a>
+  </body>
+  </html>
+  <BLANKLINE>

Modified: Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -25,8 +25,5 @@
 
         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)

Modified: Zope3/trunk/src/zope/app/zptpage/zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/zptpage.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/app/zptpage/zptpage.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -28,12 +28,13 @@
 from zope.app.filerepresentation.interfaces import IFileFactory
 from zope.app.container.contained import Contained
 from zope.app import zapi
+from zope.app.publication.interfaces import IFileContent
 
 from interfaces import IZPTPage, IRenderZPTPage
 
 class ZPTPage(AppPT, PageTemplate, Persistent, Contained):
 
-    implements(IZPTPage, IRenderZPTPage)
+    implements(IZPTPage, IRenderZPTPage, IFileContent)
 
     # See zope.app.zptpage.interfaces.IZPTPage
     expand = False

Modified: Zope3/trunk/src/zope/publisher/browser.py
===================================================================
--- Zope3/trunk/src/zope/publisher/browser.py	2005-03-15 15:04:42 UTC (rev 29474)
+++ Zope3/trunk/src/zope/publisher/browser.py	2005-03-15 15:37:18 UTC (rev 29475)
@@ -515,7 +515,7 @@
                 ob = super(BrowserRequest, self).traverse(ob)
                 ob, add_steps = publication.getDefaultTraversal(self, ob)
 
-            if nsteps > self._endswithslash:
+            if nsteps != self._endswithslash:
                 base_needed = 1
                 redirect = self.use_redirect and method == 'GET'
 



More information about the Zope3-Checkins mailing list