George Lee wrote:
I am trying to write a test for a view, and making sure that an object I've
created is associated with the correct view. But either of these lines fails
with a ComponentLookupError "Couldn't find view":
view = getView(self.event1, 'daterange_display', self.request)
view = getViewProviding(self.event1, IDateRangeDisplay, self.request)
Use getMultiAdapter. These things are deprecated.
even though in a page template that I view through the web,
context/@@daterange_display
retrieves the correct view. What am I doing incorrectly?
Well, is the test a functional test? Only functional tests have all the
configuration loaded. Otherwise you'll have to register the view first
before you can test its lookup.
By the way, testing views is best done with zope.testbrowser these days.
Thanks -- I know I've asked a flood of questions today!
Consider buying my book: http://worldcookery.com
Also consider reading the docs that are there. Zope 3 has lots of docs
(see http://localhost:8080/++apidoc++ after enabling devmode). There are
also a couple of tutorials available at http://worldcookery.com/Appetizers.
_______________________________________________
Zope3-users mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-users