[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/publisher/browser/__init__.py
Test added
Dmitry Vasiliev
dima at hlabs.spb.ru
Thu Aug 11 07:48:59 EDT 2005
Log message for revision 37860:
Test added
Changed:
U Zope3/trunk/src/zope/app/publisher/browser/__init__.py
-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/__init__.py 2005-08-11 11:05:19 UTC (rev 37859)
+++ Zope3/trunk/src/zope/app/publisher/browser/__init__.py 2005-08-11 11:48:59 UTC (rev 37860)
@@ -24,8 +24,23 @@
from zope.app.publisher.interfaces.browser import IBrowserView
from zope.publisher.interfaces.browser import ISkin
-# TODO: needs testing of __parent__ property
+
class BrowserView(Location):
+ """Browser View.
+
+ >>> view = BrowserView("context", "request")
+ >>> view.context
+ 'context'
+ >>> view.request
+ 'request'
+
+ >>> view.__parent__
+ 'context'
+ >>> view.__parent__ = "parent"
+ >>> view.__parent__
+ 'parent'
+ """
+
implements(IBrowserView)
def __init__(self, context, request):
@@ -33,7 +48,7 @@
self.request = request
def __getParent(self):
- return hasattr(self, '_parent') and self._parent or self.context
+ return getattr(self, '_parent', self.context)
def __setParent(self, parent):
self._parent = parent
@@ -90,10 +105,10 @@
>>> class SkinB(Interface): pass
>>> directlyProvides(SkinB, ISkin)
>>> class IRequest(Interface): pass
-
+
>>> class Request(object):
... implements(IRequest)
-
+
>>> req = Request()
>>> applySkin(req, SkinA)
More information about the Zope3-Checkins
mailing list