Hi - let me preface this message by saying that I _thought_ I knew how
acquisition worked, but now I'm starting to doubt.

A simple enough scenario:
Python 1.5.2 (#1, Sep 30 2000, 18:08:36)  [GCC 2.95.3 19991030
(prerelease)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import ExtensionClass
>>> import Acquisition
>>> class A(ExtensionClass.Base):
...  def foo(self):
...   print repr(self), type(self)
>>> class B(Acquisition.Implicit):
...  pass
>>> a=A()
>>> print repr(a), type(a)
<A instance at 80ec588> <extension class __main__.A at 80eb1e0>
>>> a.b=B()
>>> print repr(a.b), type(a.b)
<B instance at 80dc9c0> <extension class
Acquisition.ImplicitAcquirerWrapper at 401460e0>
>>> a.b.foo()
<A instance at 80ec588> <extension class __main__.A at 80eb1e0>

Now, I would've expected to see a.b.foo() print out exactly the same
information as repr(a.b), type(a.b). In fact, I even scrounged up the
Acquisition doc (it really isn't that easy to find these days...) and I can
quote from it in support of what I believe should be happening:

  Acquisition and methods

    Python methods of objects that support acquisition can use
    acquired attributes as in the 'report' method of the first example
    above.  When a Python method is called on an object that is
    wrapped by an acquisition wrapper, the wrapper is passed to the
    method as the first argument.  This rule also applies to
    user-defined method types and to C methods defined in pure mix-in

The middle sentence is the kicker.

The behaviour in DTML is as I'd expect - I mean, standard_html_header still
reports the correct title_or_id for me, so it must be working correctly.
But using the same codebase to do the above interactive test, I run into

Please, how did I get myself in this muddle?


Richard Jones
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)

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

Reply via email to