[Zope-dev] Help! - I want to understand Acquisition...

Bernie Rossi bprossi@bigpond.net.au
Thu, 19 Apr 2001 17:22:27 +0930


Hi,

First of all I'm converting an existing (and working) Zope
product from version 2.1.4 to 2.3.1 and I'm having the following
problem when trying to run the (new) converted version.

In a dtml document which is run many times for different types of
objects ie. something like

  <dtml-in " ... " >
      . . .
      <IMG ... src="<dtml-var expr="getIcon(REQUEST)">" ... >
      . . .
  </dtml-in>

where it iterates through a list of objects,
I get mixed results which I don't understand.

When it works the getIcon function returns the path
(using the REQUEST namespace) and icon for
the particular object type and then this gets rendered as expected.

But when it fails the icon for the type does not get rendered
at all (understandably). After some debugging (ie. print statements)
I found that when it failed the REQUEST namespace was not passing
what I expected (it was empty), and when I tried to print the namespace
it printed the following;

  <Special Object Used to Force Acquisition>

So the python function (getIcon()) was expecting the REQUEST object
but actually getting (it seems) is a derived (and unexpected) object,
and failing when looking for particular attributes.

I don't understand this behaviour (why it works for some and not others
and why it worked in a previous version of Zope) and therefore how to fix
it.

Any help or pointers on the above or other relevant issues to upgrading
older products would be appreciated.

Thanks in advance
Bernie Rossi.