[Zope-Checkins] SVN: Zope/branches/2.13/ - LP #933307: Fixed ++skin++ namespace handling.

Yvo Schubbe y.2011 at wcm-solutions.de
Thu Feb 16 10:32:44 UTC 2012


Log message for revision 124415:
  - LP #933307: Fixed ++skin++ namespace handling.

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  UU  Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
  U   Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt
  U   Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
  UU  Zope/branches/2.13/src/ZPublisher/HTTPRequest.py

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst	2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/doc/CHANGES.rst	2012-02-16 10:32:44 UTC (rev 124415)
@@ -8,6 +8,10 @@
 2.13.13 (unreleased)
 --------------------
 
+- LP #933307: Fixed ++skin++ namespace handling.
+  Ported the ``shiftNameToApplication`` implementation from zope.publisher to
+  ZPublisher.HTTPRequest.HTTPRequest.
+
 - Ensure that ObjectManager's ``get`` and ``__getitem__`` methods return only
   "items" (no attributes / methods from the class or from acquisition).
   Thanks to Richard Mitchell at Netsight for the report.

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
===================================================================
--- Zope/branches/2.13/src/Products/Five/browser/tests/pages.py	2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/pages.py	2012-02-16 10:32:44 UTC (rev 124415)
@@ -18,45 +18,59 @@
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from OFS.SimpleItem import SimpleItem
 
+
 class SimpleView(BrowserView):
+
     """More docstring. Please Zope"""
 
     def eagle(self):
         """Docstring"""
         return u"The eagle has landed"
 
+    def eagle2(self):
+        """Docstring"""
+        return u"The eagle has landed:\n%s" % self.context.absolute_url()
+
     def mouse(self):
         """Docstring"""
         return u"The mouse has been eaten by the eagle"
 
+
 class FancyView(BrowserView):
+
     """Fancy, fancy stuff"""
 
     def view(self):
         return u"Fancy, fancy"
 
+
 class CallView(BrowserView):
 
     def __call__(self):
         return u"I was __call__()'ed"
 
+
 class PermissionView(BrowserView, SimpleItem):
-    
+
     def __call__(self):
         return u"I was __call__()'ed"
 
+
 class CallTemplate(BrowserView):
 
     __call__ = ViewPageTemplateFile('falcon.pt')
 
+
 class CallableNoDocstring:
 
     def __call__(self):
         return u"No docstring"
 
+
 def function_no_docstring(self):
     return u"No docstring"
 
+
 class NoDocstringView(BrowserView):
 
     def method(self):
@@ -66,7 +80,9 @@
 
     object = CallableNoDocstring()
 
+
 class NewStyleClass(object):
+
     """
     This is a testclass to verify that new style classes work
     in browser:page


Property changes on: Zope/branches/2.13/src/Products/Five/browser/tests/pages.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt
===================================================================
--- Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt	2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/skin.txt	2012-02-16 10:32:44 UTC (rev 124415)
@@ -25,11 +25,12 @@
 It works when we explicitly use the skin that includes that layer:
 
   >>> print http(r"""
-  ... GET /test_folder_1_/testoid/++skin++TestSkin/eagle.html HTTP/1.1
+  ... GET /++skin++TestSkin/test_folder_1_/testoid/eagle.html HTTP/1.1
   ... """)
   HTTP/1.1 200 OK
   ...
-  The eagle has landed
+  The eagle has landed:
+  http://localhost/++skin++TestSkin/test_folder_1_/testoid
 
 Or when we make that skin the default skin:
 
@@ -44,7 +45,8 @@
   ... """)
   HTTP/1.1 200 OK
   ...
-  The eagle has landed
+  The eagle has landed:
+  http://localhost/test_folder_1_/testoid
 
 
 Clean up

Modified: Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml
===================================================================
--- Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml	2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/Products/Five/browser/tests/skin.zcml	2012-02-16 10:32:44 UTC (rev 124415)
@@ -14,7 +14,7 @@
   <browser:page
       for="Products.Five.tests.testing.simplecontent.ISimpleContent"
       class=".pages.SimpleView"
-      attribute="eagle"
+      attribute="eagle2"
       name="eagle.html"
       permission="zope2.Public"
       layer=".skin.ITestSkin"

Modified: Zope/branches/2.13/src/ZPublisher/HTTPRequest.py
===================================================================
--- Zope/branches/2.13/src/ZPublisher/HTTPRequest.py	2012-02-15 18:24:17 UTC (rev 124414)
+++ Zope/branches/2.13/src/ZPublisher/HTTPRequest.py	2012-02-16 10:32:44 UTC (rev 124415)
@@ -1528,10 +1528,17 @@
     def taintWrapper(self, enabled=TAINTING_ENABLED):
         return enabled and TaintRequestWrapper(self) or self
 
+    # Original version: zope.publisher.http.HTTPRequest.shiftNameToApplication
     def shiftNameToApplication(self):
         """see zope.publisher.interfaces.http.IVirtualHostRequest"""
-        # this is needed for ++skin++
+        if len(self._steps) == 1:
+            self._script.append(self._steps.pop())
+            self._resetURLS()
+            return
 
+        raise ValueError("Can only shift leading traversal "
+                         "names to application names")
+
     def getURL(self):
         return self.URL
 


Property changes on: Zope/branches/2.13/src/ZPublisher/HTTPRequest.py
___________________________________________________________________
Deleted: svn:keywords
   - Id



More information about the Zope-Checkins mailing list