Hi Tres. I just want to show you what I have so far. See the attached test file.
I took me really a lot of time to figure out all these things. Currently I'm at a point where the view is missing the activeTool which is set up in __init__. How should a zope rookie be able to write such a test if the zope pro gives up :) Jürgen Tres Seaver wrote: > I have been trying to write a doctest for the "tools" stuff to show > Jürgen Kartnaller how, so he could write a test for the bug he found > in tool deletion. > > While writing the test, I found myself mourning for the huge flock of > assorted fowl I was slaughtering, trying to get the planets aligned > so that the SiteManagerView could actually install a tool implmentation. Hugh, this sentence really needs a dictionary for a non native english speaker :) > > I have finally given up, and ask abjectly for elightenment from the > hierarchs of Z3. Please see the attached doctest and setup code for my > efforts so far, > >  http://article.gmane.org/gmane.comp.web.zope.zope3/14477 > >  http://article.gmane.org/gmane.comp.web.zope.zope3/14459 > >  No, I'm not mixing metaphors: the ritual slaughter is precisely > intended to cause the planets to realign themselves. > > Removing-bloody-apron-and-picking-down-out-of-my-ears'ly, > > > Tres. > -- > =================================================================== > Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] > Palladion Software "Excellence by Design" http://palladion.com
============== The Tools View ============== >>> from zope.app import zapi >>> from zope.app.component.browser.tools import SiteManagementView >>> from zope import interface >>> class IFooUtil(interface.Interface): ... pass >>> class FooUtil(object): ... interface.implements(IFooUtil) >>> from zope.component.interfaces import IFactory >>> from zope.component.factory import Factory >>> from zope import component >>> from zope.app.security import protectclass >>> protectclass.protectName(Factory, '__call__', 'zope.public') >>> factory = Factory(FooUtil, ... 'Utility for foo', ... 'This factory creates a foo utility.') >>> component.provideUtility(factory, IFactory, 'IFooUtil') >>> from zope.publisher.browser import TestRequest >>> request = TestRequest() >>> view = SiteManagementView('context', request) >>> view.getTools()  >>> view.update() u'' >>> request.form['ADD-TOOL-SUBMIT']='submit' >>> request.form['type_name']='IFooUtil' >>> request.form['id']='foo1' >>> view.update() >>> component.getUtility(IFooUtil, 'foo1') is not None True
_______________________________________________ Zope3-dev mailing list Zope3firstname.lastname@example.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com