[Checkins] SVN: zope.publisher/trunk/ - Backed out changes for XML-RPC skin support.

Christian Theune ct at gocept.com
Fri Dec 28 09:12:28 EST 2007


Log message for revision 82493:
  - Backed out changes for XML-RPC skin support.
  - Updated setup.py to comply to our guides
  - Merged changelog from README.txt to the change log file.
  
  

Changed:
  U   zope.publisher/trunk/CHANGES.txt
  U   zope.publisher/trunk/README.txt
  U   zope.publisher/trunk/setup.py
  U   zope.publisher/trunk/src/zope/publisher/browser.py
  U   zope.publisher/trunk/src/zope/publisher/http.py
  D   zope.publisher/trunk/src/zope/publisher/http.txt
  U   zope.publisher/trunk/src/zope/publisher/interfaces/xmlrpc.py
  U   zope.publisher/trunk/src/zope/publisher/tests/test_http.py
  U   zope.publisher/trunk/src/zope/publisher/xmlrpc.py
  U   zope.publisher/trunk/src/zope/publisher/xmlrpc.txt

-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/CHANGES.txt	2007-12-28 14:12:27 UTC (rev 82493)
@@ -2,14 +2,53 @@
 CHANGES
 =======
 
-(unreleased)
-------------
+After 3.4
+---------
 
 - Made segmentation of URLs not strip (trailing) whitespace from path segments
   to allow URLs ending in %20 to be handled correctly. (#172742)
 
 
-Before (unreleased)
--------------------
+3.4.1b2 (2007-08-02)
+--------------------
 
-No changes were tracked.
+* zope.publisher now works on Python 2.5.
+
+* Fix a problem with request.get() when the object that's to be
+  retrieved is the request itself.
+
+
+3.4.1b1 (2007-07-13)
+--------------------
+
+No changes.
+
+
+3.4.0b2 (2007-07-05)
+--------------------
+
+* Fix https://bugs.launchpad.net/zope3/+bug/122054:  
+  HTTPInputStream understands both the CONTENT_LENGTH and
+  HTTP_CONTENT_LENGTH environment variables. It is also now tolerant
+  of empty strings and will treat those as if the variable were
+  absent.
+
+
+3.4.0b1 (2007-07-05)
+--------------------
+
+* Fix caching issue. The input stream never got cached in a temp file 
+  because of a wrong content-length header lookup. Added CONTENT_LENGTH 
+  header check in addition to the previous used HTTP_CONTENT_LENGTH. The 
+  HTTP_ prefix is sometimes added by some CGI proxies, but CONTENT_LENGTH
+  is the right header info for the size.
+
+* Fix https://bugs.launchpad.net/zope3/+bug/98413:
+  HTTPResponse.handleException should set the content type
+
+
+3.4.0a1 (2007-04-22)
+--------------------
+
+Initial release as a separate project, corresponds to zope.publisher
+from Zope 3.4.0a1

Modified: zope.publisher/trunk/README.txt
===================================================================
--- zope.publisher/trunk/README.txt	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/README.txt	2007-12-28 14:12:27 UTC (rev 82493)
@@ -4,52 +4,3 @@
 request and response objects which allow for easy client interaction
 from Python.  The behaviour of the publisher is geared towards WSGI
 compatibility.
-
-Changes
-=======
-
-3.5.0a1 (unreleased)
---------------------
-
-* Generalised the skin support a bit to allow skins not only for browser but
-  also for other requests, notably XML-RPC.
-
-3.4.1b2 (2007-08-02)
---------------------
-
-* zope.publisher now works on Python 2.5.
-
-* Fix a problem with request.get() when the object that's to be
-  retrieved is the request itself.
-
-3.4.1b1 (2007-07-13)
---------------------
-
-No changes.
-
-3.4.0b2 (2007-07-05)
---------------------
-
-* Fix https://bugs.launchpad.net/zope3/+bug/122054:  
-  HTTPInputStream understands both the CONTENT_LENGTH and
-  HTTP_CONTENT_LENGTH environment variables. It is also now tolerant
-  of empty strings and will treat those as if the variable were
-  absent.
-
-3.4.0b1 (2007-07-05)
---------------------
-
-* Fix caching issue. The input stream never got cached in a temp file 
-  because of a wrong content-length header lookup. Added CONTENT_LENGTH 
-  header check in addition to the previous used HTTP_CONTENT_LENGTH. The 
-  HTTP_ prefix is sometimes added by some CGI proxies, but CONTENT_LENGTH
-  is the right header info for the size.
-
-* Fix https://bugs.launchpad.net/zope3/+bug/98413:
-  HTTPResponse.handleException should set the content type
-
-3.4.0a1 (2007-04-22)
---------------------
-
-Initial release as a separate project, corresponds to zope.publisher
-from Zope 3.4.0a1

Modified: zope.publisher/trunk/setup.py
===================================================================
--- zope.publisher/trunk/setup.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/setup.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -19,7 +19,7 @@
 from setuptools import setup, find_packages
 
 setup(name='zope.publisher',
-      version = '3.5.0a1',
+      version = '3.5dev',
       url='http://cheeseshop.python.org/pypi/zope.publisher',
       license='ZPL 2.1',
       author='Zope Corporation and Contributors',

Modified: zope.publisher/trunk/src/zope/publisher/browser.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/browser.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/browser.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -34,7 +34,6 @@
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.location import Location
 
-import zope.publisher.http
 from zope.publisher.interfaces import NotFound
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@@ -45,6 +44,7 @@
 from zope.publisher.interfaces.browser import IBrowserSkinType
 from zope.publisher.interfaces.browser import ISkinChangedEvent
 from zope.publisher.interfaces.http import IHTTPRequest
+from zope.publisher.http import HTTPRequest, HTTPResponse
 
 __ArrayTypes = (ListType, TupleType)
 
@@ -210,7 +210,7 @@
             + ", ".join(["%s: %s" % (key, repr(value))
             for key, value in items]) + "}")
 
-class BrowserRequest(zope.publisher.http.HTTPRequest):
+class BrowserRequest(HTTPRequest):
     implements(IBrowserRequest, IBrowserApplicationRequest)
 
     __slots__ = (
@@ -653,7 +653,7 @@
 
 
 
-class BrowserResponse(zope.publisher.http.HTTPResponse):
+class BrowserResponse(HTTPResponse):
     """Browser response
     """
 
@@ -1000,7 +1000,12 @@
     >>> cleanUp()
 
     """
-    zope.publisher.http.applySkin(request, skin, IBrowserSkinType)
+    # Remove all existing skin declarations (commonly the default skin).
+    ifaces = [iface for iface in directlyProvidedBy(request)
+              if not IBrowserSkinType.providedBy(iface)]
+    # Add the new skin.
+    ifaces.append(skin)
+    directlyProvides(request, *ifaces)
     zope.event.notify(SkinChangedEvent(request))
 
 class SkinChangedEvent(object):

Modified: zope.publisher/trunk/src/zope/publisher/http.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/http.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/http.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -996,17 +996,3 @@
 
     def __iter__(self):
         return iter(self.body)
-
-
-def applySkin(request, skin, skin_type):
-    """Change the presentation skin for this request.
-
-
-    """
-    # Remove all existing skin declarations (commonly the default skin).
-
-    ifaces = [iface for iface in interface.directlyProvidedBy(request)
-              if not skin_type.providedBy(iface)]
-    # Add the new skin.
-    ifaces.append(skin)
-    interface.directlyProvides(request, *ifaces)

Deleted: zope.publisher/trunk/src/zope/publisher/http.txt
===================================================================
--- zope.publisher/trunk/src/zope/publisher/http.txt	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/http.txt	2007-12-28 14:12:27 UTC (rev 82493)
@@ -1,48 +0,0 @@
-====
-HTTP
-====
-
-Generic Skin Support
-++++++++++++++++++++
-   
-The skin support is generic. Create a new skin type:
-
->>> import zope.interface
->>> import zope.interface.interfaces
->>> class ISkinType(zope.interface.interfaces.Interface):
-...     pass
-
-Create two skins:
-
->>> class SkinA(zope.interface.Interface):
-...     pass
->>> zope.interface.directlyProvides(SkinA, ISkinType)
->>> class SkinB(zope.interface.Interface):
-...     pass
->>> zope.interface.directlyProvides(SkinB, ISkinType)
-
-And create a  request:
-
->>> class IRequest(zope.interface.Interface):
-...     pass
->>> class Request(object):
-...     zope.interface.implements(IRequest)
-
->>> request = Request()
-
-Now apply SkinA two our request
-
->>> import zope.publisher.http
->>> zope.publisher.http.applySkin(request, SkinA, ISkinType)
->>> list(zope.interface.providedBy(request).interfaces())
-...     # doctest: +NORMALIZE_WHITESPACE
-[<InterfaceClass __builtin__.SkinA>,
- <InterfaceClass __builtin__.IRequest>]
-
-Applying SkinB removes SkinA:
-
->>> zope.publisher.http.applySkin(request, SkinB, ISkinType)
->>> list(zope.interface.providedBy(request).interfaces())
-...     # doctest: +NORMALIZE_WHITESPACE
-[<InterfaceClass __builtin__.SkinB>,
- <InterfaceClass __builtin__.IRequest>]

Modified: zope.publisher/trunk/src/zope/publisher/interfaces/xmlrpc.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/interfaces/xmlrpc.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/interfaces/xmlrpc.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -18,7 +18,6 @@
 
 __docformat__ = "reStructuredText"
 
-import zope.interface.interfaces
 from zope.interface import Interface
 
 from zope.publisher.interfaces import IPublication
@@ -51,5 +50,4 @@
         """Return the given object without proxies."""
 
 
-class IXMLRPCSkinType(zope.interface.interfaces.IInterface):
-    """Skin for XML-RPC."""
+

Modified: zope.publisher/trunk/src/zope/publisher/tests/test_http.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/tests/test_http.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/tests/test_http.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -778,8 +778,6 @@
     suite.addTest(unittest.makeSuite(HTTPInputStreamTests))
     suite.addTest(doctest.DocFileSuite(
         '../httpresults.txt', setUp=cleanUp, tearDown=cleanUp))
-    suite.addTest(doctest.DocFileSuite(
-        '../http.txt', setUp=cleanUp, tearDown=cleanUp))
     suite.addTest(unittest.makeSuite(APITests))
     return suite
 

Modified: zope.publisher/trunk/src/zope/publisher/xmlrpc.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/xmlrpc.py	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/xmlrpc.py	2007-12-28 14:12:27 UTC (rev 82493)
@@ -27,13 +27,13 @@
 import zope.component
 import zope.interface
 from zope.interface import implements
-from zope.publisher.interfaces.xmlrpc import (
-    IXMLRPCPublisher, IXMLRPCRequest, IXMLRPCPremarshaller, IXMLRPCSkinType)
+from zope.publisher.interfaces.xmlrpc import \
+        IXMLRPCPublisher, IXMLRPCRequest, IXMLRPCPremarshaller
 
-import zope.publisher.http
+from zope.publisher.http import HTTPRequest, HTTPResponse, DirectResult
 from zope.security.proxy import isinstance
 
-class XMLRPCRequest(zope.publisher.http.HTTPRequest):
+class XMLRPCRequest(HTTPRequest):
     implements(IXMLRPCRequest)
 
     _args = ()
@@ -80,7 +80,7 @@
         super(TestRequest, self).__init__(body_instream, _testEnv, response)
 
 
-class XMLRPCResponse(zope.publisher.http.HTTPResponse):
+class XMLRPCResponse(HTTPResponse):
     """XMLRPC response.
 
     This object is responsible for converting all output to valid XML-RPC.
@@ -117,8 +117,7 @@
         headers = [('content-type', 'text/xml;charset=utf-8'),
                    ('content-length', str(len(body)))]
         self._headers.update(dict((k, [v]) for (k, v) in headers))
-        super(XMLRPCResponse, self).setResult(
-            zope.publisher.http.DirectResult((body,)))
+        super(XMLRPCResponse, self).setResult(DirectResult((body,)))
 
 
     def handleException(self, exc_info):
@@ -233,7 +232,3 @@
     if premarshaller is not None:
         return premarshaller()
     return data
-
-
-def applySkin(request, skin):
-    zope.publisher.http.applySkin(request, skin, IXMLRPCSkinType)

Modified: zope.publisher/trunk/src/zope/publisher/xmlrpc.txt
===================================================================
--- zope.publisher/trunk/src/zope/publisher/xmlrpc.txt	2007-12-28 14:11:09 UTC (rev 82492)
+++ zope.publisher/trunk/src/zope/publisher/xmlrpc.txt	2007-12-28 14:12:27 UTC (rev 82493)
@@ -67,46 +67,3 @@
   >>> stripped_binary = premarshal(proxied_binary)
   >>> type(stripped_binary) is Proxy
   False
-
-Skin-Support
-============
-
-There is also skin support for XML-RPC:
-
-Create two skins:
-
->>> import zope.interface
->>> from zope.publisher.interfaces.xmlrpc import IXMLRPCSkinType
->>> class SkinA(zope.interface.Interface):
-...     pass
->>> zope.interface.directlyProvides(SkinA, IXMLRPCSkinType)
->>> class SkinB(zope.interface.Interface):
-...     pass
->>> zope.interface.directlyProvides(SkinB, IXMLRPCSkinType)
-
-And create a request:
-
->>> class IRequest(zope.interface.Interface):
-...     pass
->>> class Request(object):
-...     zope.interface.implements(IRequest)
-
->>> request = Request()
-
-Now apply SkinA to our request:
-
->>> import zope.publisher.xmlrpc
->>> zope.publisher.xmlrpc.applySkin(request, SkinA)
->>> list(zope.interface.providedBy(request).interfaces())
-...     # doctest: +NORMALIZE_WHITESPACE
-[<InterfaceClass __builtin__.SkinA>,
- <InterfaceClass __builtin__.IRequest>]
-
-
-Applying SkinB removes SkinA:
-
->>> zope.publisher.xmlrpc.applySkin(request, SkinB)
->>> list(zope.interface.providedBy(request).interfaces())
-...     # doctest: +NORMALIZE_WHITESPACE
-[<InterfaceClass __builtin__.SkinB>,
- <InterfaceClass __builtin__.IRequest>]



More information about the Checkins mailing list