Commit 592d22c3 authored by 's avatar

- LP #933307: Fixed ++skin++ namespace handling.

parent d499c14e
......@@ -8,6 +8,10 @@ http://docs.zope.org/zope2/releases/.
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.
......
......@@ -18,45 +18,59 @@ from Products.Five import BrowserView
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 @@ class NoDocstringView(BrowserView):
object = CallableNoDocstring()
class NewStyleClass(object):
"""
This is a testclass to verify that new style classes work
in browser:page
......
......@@ -25,11 +25,12 @@ why we can't access it straight away:
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 @@ Or when we make that skin the default skin:
... """)
HTTP/1.1 200 OK
...
The eagle has landed
The eagle has landed:
http://localhost/test_folder_1_/testoid
Clean up
......
......@@ -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"
......
......@@ -1528,9 +1528,16 @@ class HTTPRequest(BaseRequest):
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment