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 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. 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). The problem with acquisition as it currently is is that you can't use the example you have above to do something useful. You can't have a default site which you can then flavour, or skin, by adding an overriding object high up in the context tree. Example: /register is the standard way of presenting the register page. But, for internal use, you want it to look different, so you create /internal, which replaces some of the methods (like standard_html_header). You should then be able to call /internal/register and see register in the _context_ of internal, which is what is important. The containment of an object is only useful from an administrative point of view. The thing which is important is the _context_ in which the object is called. 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. 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. I have yet to think of any advantages provided by the current method, but I would be more than happy to hear of any. For reference, here a more general post on the problem I sent to the list a while ago: http://zope.nipltd.com/public/lists/zope-archive.nsf/ByKey/61727C8A78322A51 and here is a summary of the problem in the dev wiki: http://www.zope.org/Wikis/zope-dev/AcquisitionFeedback Cheers, Stephen -- Stephen Harrison stephen@nipltd.com New Information Paradigms www.nipltd.com