[Zope-Checkins] SVN: Products.Five/trunk/ stop using
Five.traversable.FakeRequest. Use z.p.browser.TestRequest instead.
Philipp von Weitershausen
philikon at philikon.de
Tue May 2 16:12:45 EDT 2006
Log message for revision 67862:
stop using Five.traversable.FakeRequest. Use z.p.browser.TestRequest instead.
Changed:
U Products.Five/trunk/browser/tests/pages.txt
U Products.Five/trunk/browser/tests/test_menu.py
U Products.Five/trunk/form/tests/test_forms.py
U Products.Five/trunk/tests/test_viewable.py
U Products.Five/trunk/viewlet/README.txt
U Products.Five/trunk/viewlet/directives.txt
-=-
Modified: Products.Five/trunk/browser/tests/pages.txt
===================================================================
--- Products.Five/trunk/browser/tests/pages.txt 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/browser/tests/pages.txt 2006-05-02 20:12:44 UTC (rev 67862)
@@ -195,10 +195,8 @@
high-level security tests). Let's manually look up a protected view:
>>> from zope.component import getMultiAdapter
- >>> from zope.publisher.browser import setDefaultSkin
- >>> from Products.Five.traversable import FakeRequest
- >>> request = FakeRequest()
- >>> setDefaultSkin(request)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
>>> view = getMultiAdapter((self.folder.testoid, request), name=u'eagle.txt')
It's protecting the object with the permission, and not the attribute,
Modified: Products.Five/trunk/browser/tests/test_menu.py
===================================================================
--- Products.Five/trunk/browser/tests/test_menu.py 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/browser/tests/test_menu.py 2006-05-02 20:12:44 UTC (rev 67862)
@@ -37,12 +37,10 @@
Now for some actual testing... Let's look up the menu we registered:
- >>> from Products.Five.traversable import FakeRequest
- >>> from zope.publisher.browser import setDefaultSkin
+ >>> from zope.publisher.browser import TestRequest
>>> from zope.app.publisher.browser.menu import getMenu
- >>> request = FakeRequest()
- >>> setDefaultSkin(request)
+ >>> request = TestRequest()
>>> menu = getMenu('testmenu', self.folder, request)
It should have
Modified: Products.Five/trunk/form/tests/test_forms.py
===================================================================
--- Products.Five/trunk/form/tests/test_forms.py 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/form/tests/test_forms.py 2006-05-02 20:12:44 UTC (rev 67862)
@@ -36,8 +36,8 @@
... values=("Mr.", "Mrs.", "Captain", "Don"))
>>> contactname = TextLine(title=u'Name')
- >>> from Products.Five.traversable import FakeRequest
- >>> request = FakeRequest()
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
>>> salutation = salutation.bind(request)
>>> contactname = contactname.bind(request)
Modified: Products.Five/trunk/tests/test_viewable.py
===================================================================
--- Products.Five/trunk/tests/test_viewable.py 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/tests/test_viewable.py 2006-05-02 20:12:44 UTC (rev 67862)
@@ -54,10 +54,10 @@
For now the default view name is index.html, like we set above:
- >>> from Products.Five.traversable import FakeRequest
- >>> request = FakeRequest()
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
>>> from zope.app.publisher.browser import queryDefaultViewName
-
+
>>> queryDefaultViewName(foo, request)
u'index.html'
>>> obj, path = bd.defaultView(request)
Modified: Products.Five/trunk/viewlet/README.txt
===================================================================
--- Products.Five/trunk/viewlet/README.txt 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/viewlet/README.txt 2006-05-02 20:12:44 UTC (rev 67862)
@@ -69,10 +69,8 @@
>>> obj_id = self.folder._setObject('content1', Content())
>>> content = self.folder[obj_id]
- >>> from Products.Five.traversable import FakeRequest
- >>> request = FakeRequest()
- >>> from zope.publisher.browser import setDefaultSkin
- >>> setDefaultSkin(request)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
>>> from Products.Five.browser import BrowserView as View
>>> view = View(content, request)
@@ -364,14 +362,6 @@
to demonstrate the helper functions here, since those demonstrations will
fully demonstrate the functionality of the base classes as well.
-To make resource lookup work we need to make the content traversable:
- >>> try:
- ... from Products.Five.fiveconfigure import classTraversable
- ... classTraversable(Content)
- ...
- ... except ImportError:
- ... pass
-
The viewlet will look up the resource it was given and tries to produce the
absolute URL for it:
Modified: Products.Five/trunk/viewlet/directives.txt
===================================================================
--- Products.Five/trunk/viewlet/directives.txt 2006-05-02 20:11:49 UTC (rev 67861)
+++ Products.Five/trunk/viewlet/directives.txt 2006-05-02 20:12:44 UTC (rev 67862)
@@ -40,10 +40,8 @@
>>> obj_id = self.folder._setObject('content1', Content())
>>> content = self.folder[obj_id]
- >>> from Products.Five.traversable import FakeRequest
- >>> request = FakeRequest()
- >>> from zope.publisher.browser import setDefaultSkin
- >>> setDefaultSkin(request)
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
>>> from Products.Five.browser import BrowserView as View
>>> view = View(content, request)
More information about the Zope-Checkins
mailing list