On Thu, 13 Jul 2000, Stephen Harrison wrote:
Curtis Maloney wrote:
[snip]
Well, here's the details:
/ standard_html_header register /internal/ standard_html_header
register works fine if invoked as /register however, it spits the dummy if invoked as /internal/register Complaining loudly about TypeError: too many arguments; expected 2, got 3 in standard_html_header.
Is register a method, or a document? If it is a method the when you
It is a document.
call /internal/register you are calling the object internal with the method register, so when it looks for standard_html_header it will first look in internal, before doing the acquisition thing. So it finds internal/standard_html_header. If it is a document, then you are calling the object /register, in the context of internal, but the containment of / so you get /standard_html_header.
Yes, well.. This is what I worked out from the Acquisition Algebra tute, and from MP, but this is not what the actions of the site suggest. When I modified /internal/standard_html_header, the actions of register as /internal/register changed. This is what has me so confused. That, and the fact the page give an error at all, when it works frine as /register.
In algebra terms, if register is a method, you have
(internal o /)
but if register is a document (or folder, or other object) you have
((register o /) o (internal o /))
This is how acquisition (simple acquisition) behaves.
Of course, I am strongly of the opinion that this method of acquisition is of very limited use and zope should really use natural acquisition (see http://www.zope.org/Wikis/zope-dev/AcquisitionUsage for a definition).
[snip]
As it is, in order to achieve the result described above you have to carefully construct your site in order to work around the problems with acquisition, which really isn't the way we should be doing things.
Well, it just so happens this is what I'm doing next. (o8 I was handed this site to "fix", which has taken a lot of work. However, rewriting it properly would have taken longer, and the project was already overdue.
Sorry to go on about this, but as time passes I am becomming more and more convinced that the method of acquisition needs to change from containment before context to context before containment.
Rant away, please. I believe it can be a great way to provoke ideas in other people. Besides, if we never complained, how would they know there was a problem? (o8
I have yet to think of any advantages provided by the current method, but I would be more than happy to hear of any.
Cheers, Stephen
Thanks for trying, Curtis.