[Zope3-dev] Re: Keening for the poultry

2005-10-18 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stephan Richter wrote:
 On Thursday 13 October 2005 11:48, Tres Seaver wrote:
 
I have been trying to write a doctest for the tools stuff to show
Jürgen Kartnaller how[1], so he could write a test for the bug he found
in tool deletion[2].

While writing the test, I found myself mourning for the huge flock of
assorted fowl I was slaughtering, trying to get the planets aligned[3]
so that the SiteManagerView could actually install a tool implmentation.

I have finally given up, and ask abjectly for elightenment from the
hierarchs of Z3.
 
 
 Tres,
 
 Jim has some ideas on how to make this all much simpler. Just the fact that 
 you have to introduce the concept of tools is a dead chicken,

Registering a tool isn't a dead chicken:  it is the mechanism which
allows software developers to offer candidate local utilities, which
can then be added / configured by the site admin into a local site
manager later (one is mechanism, the other is policy).  In the global
site manager, there is no need for the equivalent registration because
the policy is in the same place (the site's ZCML).

 since utilities 
 should be enough. Once we have adapters we might rethink this, but I would 
 think that adapters live in persistent modules, which are utilities in 
 return. ;-)

Most tools will *not* be in persistent modules;  they will be persistent
instances created from filesystem software.  I do not expect to depend
on persistent modules for CMF 2.0, for instance, for at least a year.

 If you are willing to work on this, I am willing to help you draft a proposal 
 (so would Jim, I think).

The particular dead chickens I complained of (in the attachment to my
original message) were the need to register factories / menus / menu
items in order to test the site manager view.  Those sacrifices were due
to an (expedient, I think) choice to reuse the content add menu
machinery inside the site manager.  None of that is needful or
interesting, given that there is *zero* overlap between the kinds of
things which one might add in content space versus site management space.


Tres.
- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDVQka+gerLs4ltQ4RAsDeAKDR6gYGrI9n0EiokdZUrBfzqWWtAACcD2hg
tIOvpUGLuQoHFtvrg1uib+8=
=NbN1
-END PGP SIGNATURE-

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: Keening for the poultry

2005-10-13 Thread jürgen Kartnaller
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[1], so he could write a test for the bug he found
 in tool deletion[2].
 
 While writing the test, I found myself mourning for the huge flock of
 assorted fowl I was slaughtering, trying to get the planets aligned[3]
 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,
 
 [1] http://article.gmane.org/gmane.comp.web.zope.zope3/14477
 
 [2] http://article.gmane.org/gmane.comp.web.zope.zope3/14459
 
 [3] 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 Designhttp://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
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com