mς γΈEc@swdZdkZdkZedjo$eeiieiddƒƒnd„Zd„Zedjo e ƒndS(sWTest default view recursion $Id: test_recurse.py 67728 2006-04-28 17:57:47Z regebro $ Nt__main__is framework.pycCsdS(sŽ Test recursion This test makes sure that recursion is avoided for view lookup. First, we need to set up a stub interface... >>> from zope.interface import Interface, implements >>> class IRecurse(Interface): ... pass ... and a class that is callable and has a view method: >>> from OFS.Traversable import Traversable >>> class Recurse(Traversable): ... implements(IRecurse) ... def view(self): ... return self() ... def __call__(self): ... return 'foo' ... Now we register a default view name for the class: >>> from zope.component import provideAdapter >>> from zope.publisher.interfaces.browser import IBrowserRequest >>> from zope.component.interfaces import IDefaultViewName >>> provideAdapter(u'view', (IRecurse, IBrowserRequest), IDefaultViewName) Here comes the actual test: >>> ob = Recurse() >>> ob.view() 'foo' >>> ob() 'foo' Clean up adapter registry and monkey patches to classes: >>> from zope.testing.cleanup import cleanUp >>> cleanUp() N((((tG/data/zmath/zope/lib/python/Products/Five/browser/tests/test_recurse.pyttest_recursions+cCsdkl}|ƒS(N(sZopeDocTestSuite(tTesting.ZopeTestCasetZopeDocTestSuite(R((Rt test_suiteCs ( t__doc__tostsyst__name__texecfiletpathtjoinRRt framework(RRRR((Rt?s $ -