[Checkins] SVN: z3c.traverser/trunk/src/z3c/traverser/viewlet/ added viewlet traversing

Bernd Dorn bernd.dorn at lovelysystems.com
Fri Feb 2 10:39:59 EST 2007


Log message for revision 72327:
  added viewlet traversing

Changed:
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/BROWSER.txt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/README.txt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/__init__.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/browser.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/configure.zcml
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/ftesting.zcml
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/ftests.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/namespace.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/test.pt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/__init__.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/app.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/manager.pt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/myviewlet.pt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/test.pt
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/testing.py
  A   z3c.traverser/trunk/src/z3c/traverser/viewlet/tests.py

-=-
Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/BROWSER.txt
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/BROWSER.txt	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/BROWSER.txt	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,36 @@
+====================
+ Viewlet Traversing
+====================
+
+Traversing to viewlets is done via namespaces.
+
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.handleErrors = False
+  >>> browser.open('http://localhost/@@test.html')
+
+We have a test page registered that containes our viewlet. The viewlet
+itself just renders a link to its location (this is just for testing).
+  
+  >>> print browser.contents
+  <html>
+    <body>
+       <div><div><a
+       href="http://localhost/test.html/++manager++IMyManager/++viewlet++MyViewlet">My
+       Viewlet</a></div></div>
+    </body>
+  </html>
+
+Let's follow the link to traverse the viewlet directly.
+
+  >>> browser.getLink('My Viewlet').click()
+  >>> browser.url
+  'http://localhost/test.html/++manager++IMyManager/++viewlet++MyViewlet'
+  >>> print browser.contents
+  <div><a href="http://localhost/test.html/++manager++IMyManager/++viewlet++MyViewlet">My Viewlet</a></div>
+
+Ceveats
+=======
+
+Update of the manager is not called, because this may be too expensive
+and normally the managers update just collects viewlets.


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/BROWSER.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/README.txt
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/README.txt	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/README.txt	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,92 @@
+===================
+Traversing Viewlets
+===================
+
+This package allows to traverse viewlets and viewletmanagers. It also
+provides absolute url views for those objects which are described in
+this file, for traversers see BROWSER.txt.
+
+  >>> from z3c.traverser.viewlet import browser
+
+Let us define some test classes.
+
+  >>> import zope.component
+  >>> from zope.viewlet import manager
+  >>> from zope.viewlet import interfaces
+  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+  >>> import zope.interface
+  >>> class ILeftColumn(interfaces.IViewletManager):
+  ...     """Viewlet manager located in the left column."""
+  >>> LeftColumn = manager.ViewletManager('left', ILeftColumn)
+  >>> zope.component.provideAdapter(
+  ...     LeftColumn,
+  ...     (zope.interface.Interface,
+  ...     IDefaultBrowserLayer, zope.interface.Interface),
+  ...     interfaces.IViewletManager, name='left')
+
+You can then create a viewlet manager using this interface now:
+
+
+  >>> from zope.viewlet import viewlet
+  >>> from zope.app.container.contained import Contained
+
+  >>> class Content(Contained):
+  ...     pass
+  >>> root['content'] = Content()
+  >>> content = root['content']
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> from zope.publisher.interfaces.browser import IBrowserView
+  >>> from zope.publisher.browser import BrowserView
+  >>> class View(BrowserView):
+  ...     pass
+
+We have to set the name, this is normally done in zcml.
+
+  >>> view = View(content, request)
+  >>> view.__name__ = 'test.html'
+  >>> leftColumn = LeftColumn(content, request, view)
+
+Let us create a simple viewlet. Note that we need a __name__ attribute
+in order to make the viewlet traversable. Normally you don't have to
+take care of this, because the zcml directive sets the name upon
+registration.
+
+  >>> class MyViewlet(viewlet.ViewletBase):
+  ...     __name__ = 'myViewlet'
+  ...     def render(self):
+  ...         return u'<div>My Viewlet</div>'
+  >>> from zope.security.checker import NamesChecker, defineChecker
+  >>> viewletChecker = NamesChecker(('update', 'render'))
+  >>> defineChecker(MyViewlet, viewletChecker)
+
+  >>> zope.component.provideAdapter(
+  ...     MyViewlet,
+  ...     (zope.interface.Interface, IDefaultBrowserLayer,
+  ...     IBrowserView, ILeftColumn),
+  ...     interfaces.IViewlet, name='myViewlet')
+
+We should now be able to get the absolute url of the viewlet and the
+manager. We have to register the adapter for the test.
+
+  >>> from zope.traversing.browser.interfaces import IAbsoluteURL
+  >>> from zope.traversing.browser import absoluteurl
+
+  >>> zope.component.provideAdapter(
+  ...     browser.ViewletAbsoluteURL,
+  ...     (interfaces.IViewlet, IDefaultBrowserLayer),
+  ...     IAbsoluteURL)
+  >>> zope.component.provideAdapter(
+  ...     browser.ViewletManagerAbsoluteURL,
+  ...     (interfaces.IViewletManager, IDefaultBrowserLayer),
+  ...     IAbsoluteURL, name="absolute_url")
+  >>> zope.component.provideAdapter(
+  ...     browser.ViewletManagerAbsoluteURL,
+  ...     (interfaces.IViewletManager, IDefaultBrowserLayer),
+  ...     IAbsoluteURL)
+  >>> myViewlet = MyViewlet(content, request, view, leftColumn)
+  >>> absoluteurl.absoluteURL(leftColumn, request)
+  'http://127.0.0.1/content/test.html/++manager++left'  
+  >>> absoluteurl.absoluteURL(myViewlet, request)
+  '.../content/test.html/++manager++left/++viewlet++myViewlet'
+


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/__init__.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/__init__.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/__init__.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1 @@
+#


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/browser.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/browser.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/browser.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,54 @@
+from zope.traversing.browser import absoluteurl
+from zope.traversing.browser.interfaces import IAbsoluteURL
+import zope.component
+import urllib
+
+class ViewletAbsoluteURL(absoluteurl.AbsoluteURL):
+
+    def __str__(self):
+        context = self.context
+        request = self.request
+
+        # The application URL contains all the namespaces that are at the
+        # beginning of the URL, such as skins, virtual host specifications and
+        # so on.
+
+        container = getattr(context, 'manager', None)
+        if container is None:
+            raise TypeError(absoluteurl._insufficientContext)
+
+        url = str(zope.component.getMultiAdapter((container, request),
+                                                 name='absolute_url'))
+
+        name = self._getContextName(context)
+        if name is None:
+            raise TypeError(absoluteurl._insufficientContext)
+
+        if name:
+            url += '/' + urllib.quote(name.encode('utf-8'),
+                                      absoluteurl._safe)
+
+        return url
+
+    def _getContextName(self, context):
+        name = super(ViewletAbsoluteURL,
+                     self)._getContextName(context)
+        return u'++viewlet++' + name
+
+
+    __call__ = __str__
+
+class ViewletManagerAbsoluteURL(absoluteurl.AbsoluteURL):
+
+    def _getContextName(self, context):
+        name = super(ViewletManagerAbsoluteURL,
+                     self)._getContextName(context)
+        return u'++manager++' + name
+
+class ViewletView(object):
+
+    def __call__(self):
+        self.context.update()
+        return self.context.render()
+    
+        


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/browser.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/configure.zcml
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/configure.zcml	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/configure.zcml	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,87 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:i18n="http://namespaces.zope.org/i18n"
+           xmlns:browser="http://namespaces.zope.org/browser"
+           i18n_domain="zope">
+  
+  <view
+      for="zope.viewlet.interfaces.IViewlet"
+      name="absolute_url"
+      factory=".browser.ViewletAbsoluteURL"
+      type="zope.publisher.interfaces.http.IHTTPRequest"
+      permission="zope.Public"
+      allowed_interface="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+
+  <view
+      for="zope.viewlet.interfaces.IViewlet"
+      factory=".browser.ViewletAbsoluteURL"
+      type="zope.publisher.interfaces.http.IHTTPRequest"
+      permission="zope.Public"
+      provides="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+
+  <browser:page
+      for="zope.viewlet.interfaces.IViewlet"
+      name="absolute_url"
+      class=".browser.ViewletAbsoluteURL"
+      permission="zope.Public"
+      allowed_interface="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+  <view
+      for="zope.viewlet.interfaces.IViewletManager"
+      name="absolute_url"
+      factory=".browser.ViewletManagerAbsoluteURL"
+      type="zope.publisher.interfaces.http.IHTTPRequest"
+      permission="zope.Public"
+      allowed_interface="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+
+  <view
+      for="zope.viewlet.interfaces.IViewletManager"
+      factory=".browser.ViewletManagerAbsoluteURL"
+      type="zope.publisher.interfaces.http.IHTTPRequest"
+      permission="zope.Public"
+      provides="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+
+  <browser:page
+      for="zope.viewlet.interfaces.IViewletManager"
+      name="absolute_url"
+      class=".browser.ViewletManagerAbsoluteURL"
+      permission="zope.Public"
+      allowed_interface="zope.traversing.browser.interfaces.IAbsoluteURL"
+      />
+
+  <adapter
+      name="manager"
+      provides="zope.traversing.interfaces.ITraversable" for="*"
+      factory=".namespace.ViewletManagerHandler"
+  />
+  
+  <view
+      name="manager"
+      type="zope.interface.Interface"
+      provides="zope.traversing.interfaces.ITraversable" for="*"
+      factory=".namespace.ViewletManagerHandler"/>
+
+
+  <adapter
+      name="viewlet"
+      provides="zope.traversing.interfaces.ITraversable" for="*"
+      factory=".namespace.ViewletHandler"
+      />
+  
+  <view
+      name="viewlet"
+      type="zope.interface.Interface"
+      provides="zope.traversing.interfaces.ITraversable" for="*"
+      factory=".namespace.ViewletHandler"
+      />
+
+  <browser:page
+      for="zope.viewlet.interfaces.IViewlet"
+      name="index.html"
+      class=".browser.ViewletView"
+      permission="zope.Public"/>
+  
+</configure>
\ No newline at end of file


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/ftesting.zcml
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/ftesting.zcml	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/ftesting.zcml	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,83 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           xmlns:browser="http://namespaces.zope.org/browser"
+           xmlns:meta="http://namespaces.zope.org/meta"
+           i18n_domain="zope">
+
+  <include package="zope.app" />
+  
+  <include package="zope.viewlet" file="meta.zcml"/>
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+
+  <include package="zope.app.server" />
+  <include package="zope.app.authentication" />
+  
+  <securityPolicy
+      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+  <include package="zope.app.securitypolicy" />
+
+  <role id="zope.Anonymous" title="Everybody"
+        description="All users have this role implicitly" />
+
+  <role id="zope.Manager" title="Site Manager" />
+
+  
+  <principal
+   id="zope.manager"
+   title="Administrator"
+   login="mgr"
+   password="mgrpw" />
+  <grant
+   role="zope.Manager"
+   principal="zope.manager"
+   />
+  
+  <unauthenticatedPrincipal
+    id="zope.anybody"
+    title="Unauthenticated User" />
+
+  <unauthenticatedGroup
+    id="zope.Anybody"
+    title="Unauthenticated Users" 
+    />
+
+  <authenticatedGroup
+    id="zope.Authenticated"
+    title="Authenticated Users" 
+    />
+
+  <everybodyGroup
+    id="zope.Everybody"
+    title="All Users" 
+    />
+  
+  <include package="zope.contentprovider"/>
+  <include package="zope.viewlet"/>
+  <include package="z3c.traverser.viewlet"/>
+
+  <grant permission="zope.View"
+         role="zope.Anonymous" />
+  
+  <grantAll role="zope.Manager" />
+
+  <configure package="z3c.traverser.viewlet.testing">
+  <browser:viewlet
+      name="MyViewlet"
+      manager=".app.IMyManager"
+      class=".app.MyViewlet"
+      permission="zope.Public"/>
+  
+  <browser:viewletManager
+      name="IMyManager"
+      provides=".app.IMyManager"
+      permission="zope.Public"
+      />
+
+  <browser:page
+      for="*"
+      name="test.html"
+      template="test.pt"
+      permission="zope.Public"
+      />
+  </configure>
+</configure>


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/ftests.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/ftests.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/ftests.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,19 @@
+import unittest
+from zope.app.testing import functional
+
+functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suites = (
+        functional.FunctionalDocFileSuite('BROWSER.txt',
+                                          ),
+        )
+    for s in suites:
+        s.layer=TestLayer
+        suite.addTest(s)
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/ftests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/namespace.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/namespace.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/namespace.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,34 @@
+from zope.traversing.namespace import SimpleHandler
+from zope import component
+from zope.security.proxy import removeSecurityProxy
+from zope.publisher.interfaces import NotFound
+from zope.viewlet.interfaces import IViewletManager, IViewlet
+
+class ViewletManagerHandler(SimpleHandler):
+
+    def __init__(self, context, request=None):
+        self.context = context
+        self.request = request
+
+    def traverse(self, name, ignored):
+        provider = component.queryMultiAdapter(
+            (self.context.__parent__,
+             self.request, self.context),
+            IViewletManager, name)
+        if provider is None:
+            raise NotFound(self.context, name, self.request)
+        return provider
+
+
+class ViewletHandler(SimpleHandler):
+
+    def __init__(self, context, request=None):
+        self.context = context
+        self.request = request
+
+    def traverse(self, name, ignored):
+        # Try to look up the provider.
+        viewlet = self.context.get(name)
+        if viewlet is None:
+            raise NotFound(self.context, name, self.request)
+        return viewlet


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/namespace.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/test.pt
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/test.pt	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/test.pt	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,5 @@
+<html>
+  <body>
+    <div tal:content="structure provider:IMyManager"/>
+  </body>
+</html>
\ No newline at end of file


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/test.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/__init__.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/__init__.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/__init__.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1 @@
+#


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/app.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/app.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/app.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,17 @@
+from zope.viewlet import interfaces
+from zope.traversing.browser.absoluteurl import absoluteURL
+from zope import interface
+
+class IMyManager(interfaces.IViewletManager):
+    """Viewlet manager"""
+
+class MyViewlet(object):
+
+    def upate(self):
+        pass
+
+    def render(self):
+        return '<div><a href="%s">My Viewlet</a></div>' % \
+               absoluteURL(self, self.request)
+
+


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/app.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/manager.pt
===================================================================


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/manager.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/myviewlet.pt
===================================================================


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/myviewlet.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/test.pt
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/test.pt	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/test.pt	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,5 @@
+<html>
+  <body>
+    <div tal:content="structure provider:IMyManager"/>
+  </body>
+</html>
\ No newline at end of file


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing/test.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing.py
===================================================================


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/testing.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: z3c.traverser/trunk/src/z3c/traverser/viewlet/tests.py
===================================================================
--- z3c.traverser/trunk/src/z3c/traverser/viewlet/tests.py	2007-02-02 15:25:58 UTC (rev 72326)
+++ z3c.traverser/trunk/src/z3c/traverser/viewlet/tests.py	2007-02-02 15:39:58 UTC (rev 72327)
@@ -0,0 +1,35 @@
+import doctest
+import unittest
+from zope.testing.doctestunit import DocFileSuite, DocFileSuite
+from zope.app.testing import setup
+import zope.traversing.testing
+from zope.traversing.testing import browserView
+from zope.traversing.browser import AbsoluteURL, SiteAbsoluteURL
+from zope.traversing.interfaces import IContainmentRoot
+from zope.traversing.browser.interfaces import IAbsoluteURL
+
+def setUp(test):
+    root = setup.placefulSetUp(True)
+    zope.traversing.testing.setUp()
+    test.globs['root'] = root
+
+    browserView(None, 'absolute_url', AbsoluteURL)
+    browserView(IContainmentRoot, 'absolute_url', SiteAbsoluteURL)
+    browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
+    browserView(IContainmentRoot, '', SiteAbsoluteURL, providing=IAbsoluteURL)
+
+def tearDown(test):
+    setup.placefulTearDown()
+
+def test_suite():
+    
+    return unittest.TestSuite(
+        (
+        DocFileSuite('README.txt',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: z3c.traverser/trunk/src/z3c/traverser/viewlet/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Checkins mailing list