[Checkins] SVN: grok/trunk/ Now use the KGS versions of zope.publisher and zope.traversing; we needed

Martijn Faassen faassen at infrae.com
Wed Apr 30 15:32:24 EDT 2008


Log message for revision 85930:
  Now use the KGS versions of zope.publisher and zope.traversing; we needed
  retrieve some code from older versions of zope.publisher and zope.traversing
  to integrate it into Grok.
  

Changed:
  U   grok/trunk/CHANGES.txt
  U   grok/trunk/doc/upgrade.txt
  U   grok/trunk/src/grok/ftests/rest/rest_traverse.py
  U   grok/trunk/src/grok/rest.py
  U   grok/trunk/src/grok/util.py
  U   grok/trunk/versions.cfg

-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/CHANGES.txt	2008-04-30 19:32:24 UTC (rev 85930)
@@ -10,6 +10,9 @@
 * Merged the versions from the 3.4 KGS:
   http://download.zope.org/zope3.4/versions-3.4.0c1.cfg
 
+  We are now using the latest Zope 3 releases for all the Zope 
+  For upgrade notes, see doc/upgrade.txt for more information.
+
 * Added support for easier testsetup based on z3c.testsetup. This is a
   more stable and more powerful implementation of
   grok.testing.register_all_tests(). See

Modified: grok/trunk/doc/upgrade.txt
===================================================================
--- grok/trunk/doc/upgrade.txt	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/doc/upgrade.txt	2008-04-30 19:32:24 UTC (rev 85930)
@@ -9,12 +9,11 @@
 Upgrading to 0.13
 -----------------
 
-- We moved to newer versions of zope packages.  This means your code
-  can now get some new deprecation warnings for imports that have been
-  moved.  Please check your code and fix your imports if you get those
-  warnings.
+- We moved to newer versions of zope packages, using the KGS list for
+  Zope 3.4c1.  This means your code can now get some new deprecation
+  warnings for imports that have been moved. Please check your code
+  and fix your imports if you get those warnings.
 
-
 Upgrading to 0.12
 -----------------
 

Modified: grok/trunk/src/grok/ftests/rest/rest_traverse.py
===================================================================
--- grok/trunk/src/grok/ftests/rest/rest_traverse.py	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/src/grok/ftests/rest/rest_traverse.py	2008-04-30 19:32:24 UTC (rev 85930)
@@ -51,7 +51,7 @@
 
 import grok
 from zope.interface import Interface
-from zope.publisher.http import applySkin
+from grok.util import applySkin
 
 class IFoo(Interface):
     pass

Modified: grok/trunk/src/grok/rest.py
===================================================================
--- grok/trunk/src/grok/rest.py	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/src/grok/rest.py	2008-04-30 19:32:24 UTC (rev 85930)
@@ -1,8 +1,10 @@
 import grok
 
 from zope import component
+from zope.component.interfaces import ComponentLookupError
 
-from zope.traversing.namespace import skin
+from zope.traversing.interfaces import TraversalError
+from zope.traversing.namespace import view
 from zope.interface import Interface
 from zope.interface.interfaces import IInterface
 from zope.publisher.interfaces.browser import IBrowserRequest
@@ -12,6 +14,7 @@
 import zope.location
 
 from grok.interfaces import IRESTSkinType
+from zope.publisher.browser import applySkin
 
 class RestPublisher(zope.location.Location):
     grok.implements(IBrowserPublisher)
@@ -51,9 +54,21 @@
         self.request.response.setHeader('Allow', ', '.join(self.allow))
         self.request.response.setStatus(405)
         return 'Method Not Allowed'
+
+class rest_skin(view):
+    """A rest skin.
     
-class rest_skin(skin):
-    skin_type = IRESTSkinType
+    This used to be supported by zope.traversing but the change was backed out.
+    We need it for our REST support.
+    """
+    def traverse(self, name, ignored):
+        self.request.shiftNameToApplication()
+        try:
+            skin = component.getUtility(IRESTSkinType, name)
+        except ComponentLookupError:
+            raise TraversalError("++rest++%s" % name)
+        applySkin(self.request, skin)
+        return self.context
 
 class DefaultRest(grok.REST):
     grok.context(Interface)

Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/src/grok/util.py	2008-04-30 19:32:24 UTC (rev 85930)
@@ -18,6 +18,7 @@
 
 import zope.location.location
 from zope import component
+from zope import interface
 from zope.traversing.browser.interfaces import IAbsoluteURL
 from zope.traversing.browser.absoluteurl import _safe as SAFE_URL_CHARACTERS
 
@@ -188,3 +189,14 @@
     check_module_component(class_, component,
                            component_name, component_directive)
     return component
+
+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)
+

Modified: grok/trunk/versions.cfg
===================================================================
--- grok/trunk/versions.cfg	2008-04-30 18:55:41 UTC (rev 85929)
+++ grok/trunk/versions.cfg	2008-04-30 19:32:24 UTC (rev 85930)
@@ -45,7 +45,7 @@
 zope.app.preference = 3.4.1
 zope.app.principalannotation = 3.4
 zope.app.publication = 3.4.3
-zope.app.publisher = 3.5a2
+zope.app.publisher = 3.4.1
 zope.app.renderer = 3.4
 zope.app.rotterdam = 3.4.1
 zope.app.schema = 3.4
@@ -87,7 +87,7 @@
 zope.modulealias = 3.4
 zope.pagetemplate = 3.4
 zope.proxy = 3.4
-zope.publisher = 3.5.0a1.dev-r78838
+zope.publisher = 3.4.2
 zope.schema = 3.4
 zope.security = 3.4
 zope.securitypolicy = 3.4
@@ -100,5 +100,5 @@
 zope.testbrowser = 3.4.2
 zope.testing = 3.5.1
 zope.thread = 3.4
-zope.traversing = 3.5.0a1.dev-r78730
+zope.traversing = 3.4.0
 zope.viewlet = 3.4.2



More information about the Checkins mailing list