On 19.06.2007, at 19:46, Philipp von Weitershausen wrote:

Christian Theune wrote:
I can't remember who I talked to about this who pointed out to me that, in most cases, you don't have to care about the `default` folder and can
put the utilities that you don't want in content space just directly
into the site manager.
Due to that I don't see a reason for a `default` site-management folder
inside the site manager. I never had the use-case for more than one
package, but I'm also somewhat unsure what they really are about.
I just re-read the doctests in zope.app.component and they only talk
about the mechanics of the site managers and site-management folders.
They give a vague hint that they can be used to "logically organize your
software". I don't think I'm going to "organize" my software in the
ZODB, so I'm a bit puzzled at what that means.

Site management folders had a meaning and incorporated machinery once. That's gone now. They're just dumb containers now. The 'default' thing is an artefact. It is totally possible to add your local utilities anywhere you want, they don't even have to be in a container as long as they're persisted in the registry.

In the interest of removing cruft and making things more straight- forward for newbies, 'default' should be ripped out. In the interest of existing projects, however, BBB must provided.


I suggest a hack: We remove 'default' and from now on put utilities directly into the site manager. For BBB, we allow access to a 'default' subcontainer which is faked::

  Let's get a site and look at its site manager:

    >>> site = getSite()
    >>> site_manager = site.getSiteManager()

The site manager is empty or, in case of the root site manager, it has
  a few default utilities:

    >>> list(site_manager.keys())
    ['ErrorReportingUtility', 'ClientIDManager', ...]

Even though there seems to be no 'default' folder anymore, it's still
  possible to get it:

    >>> default_folder = site_manager['default']
    >>> list(default_folder.keys())
    ['ErrorReportingUtility', 'ClientIDManager', ...]


  (I imagine site_manager.__getitem__ simply returning self when
   key == 'default')

i think we should let people create a thing called 'default' if they want to, it just doesn't matter

why not just raise a deprecation warning if no default folder is there and some code traverses default, but if an object is there with this name it should be alright because then the default folder was created in an old release or by intent.

  Note that adding a subitem called 'default' won't be allowed:

    >>> site_manager['default'] = object()
    Traceback (most recent call last):

http://worldcookery.com -- Professional Zope documentation and training
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/bernd.dorn% 40lovelysystems.com

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

Reply via email to