[Zope3-dev] Re: AW: deprecate ++etc++site/default?
Christian Zagrodnick
cz at gocept.com
Wed Jun 20 02:01:41 EDT 2007
On 2007-06-19 22:13:59 +0200, Bernd Dorn <bernd.dorn at lovelysystems.com> said:
>
> 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.
>
> +1
>
>>
>> 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', ...]
>>
>
> +1
>
>> (I imagine site_manager.__getitem__ simply returning self when
>> key == 'default')
>>
>
> -1
> 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.
Right. I guess we should check if there is an object called default. If
there is just don't do anything special. If there is not return self
with deprecation warning.
>
>> Note that adding a subitem called 'default' won't be allowed:
>>
>> >>> site_manager['default'] = object()
>> Traceback (most recent call last):
>> ...
Your -1 goes was for this part, was it not?
--
Christian Zagrodnick
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
More information about the Zope3-dev
mailing list