Re: [Zope] Acquisition problems?

2000-07-13 Thread Curtis Maloney

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.

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Acquisition problems?

2000-07-13 Thread Stephen Harrison

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[EMAIL PROTECTED]
New Information Paradigms   www.nipltd.com

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Acquisition problems?

2000-07-12 Thread Curtis Maloney


Ok... I'm going try this again.

I am having an odd problem with my Zope site.  It seems that Acquisition is 
not working as excpected. (Gee.  Where have we heard this before? :)

At the suggestion of Martijn Pieters, I read through the Acquisition Algebra 
tutorial.  Interesting stuff.

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.

According to what MP told me, and what I read, register should be using 
/standard_html_header

However, that method is just raw HTML (no DTML tags), and has been shown to 
work fine.  But when I started messing with /interna/standard_html_header to 
try to track down the problem, things started changing, implying that IT was 
being used, not the root version.

How can this be?
Why is it?
And, what would cause a DTML method, invoked with , to complain about the number of arguments?

Have a better one,
Curtis Maloney.



P.S: Just for the fun of it, here's the latest traceback:

Zope Error

Zope has encountered an error while publishing this resource. 

TypeError

Sorry, a Zope error occurred.

Traceback (innermost last):
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, 
line 214, in publish_module
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, 
line 179, in publish
  File /usr/local/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 
202, in zpublisher_exception_hook
(Object: ElementWithAttributes)
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, 
line 165, in publish
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
(Object: register)
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, 
line 102, in call_object
(Object: register)
  File /usr/local/Zope-2.1.6-src/lib/python/OFS/DTMLDocument.py, line 
166, in __call__
(Object: register)
  File 
/usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py, line 502, 
in __call__
(Object: register)
  File /usr/local/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line 
146, in __call__
(Object: standard_html_header)
  File 
/usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py, line 502, 
in __call__
(Object: standard_html_header)
TypeError: too many arguments; expected 2, got 3


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )