[Zope3-checkins]
SVN: Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/__init__.py
Merged revision 37860 from the trunk: Test added
Dmitry Vasiliev
dima at hlabs.spb.ru
Thu Aug 11 08:51:03 EDT 2005
Log message for revision 37864:
Merged revision 37860 from the trunk: Test added
Changed:
U Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/__init__.py
-=-
Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/__init__.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/__init__.py 2005-08-11 12:03:34 UTC (rev 37863)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/__init__.py 2005-08-11 12:51:03 UTC (rev 37864)
@@ -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