[Zope] <dtml-with "portal_url.getPortalObject()"> gives AttributeError

Dieter Maurer dieter at handshake.de
Wed Nov 12 16:05:57 EST 2003


Marc Lindahl wrote at 2003-11-12 11:54 -0500:
 > 
 > On Tuesday, November 11, 2003, at 02:26  PM, Dieter Maurer wrote:
 > 
 > > Marc Lindahl wrote at 2003-11-11 11:31 -0500:
 > >> Good point... how the heck to I get around it??
 > >
 > > First of all, you must find the place where
 > > "portal_url" is defined in the wrong way.
 > > Only then, can we find out how to work around that.
 > >
 > 
 > Wrong way, or accessed such that it returns a string?  The latter I 
 > have run into before, the string gets cached somehow.... very hard to 
 > track down but there was a workaround that I forgot, getattr or 
 > something.  Thought you'd remember.  I don't think portal_url is 
 > actually redefined...

You are right.

Caching would be possible, too.
I think, "dtml-var", "dtml-if" and "dtml-in" are caching.

I fear, there is no way to access the uncached value through
direct use of "_". "_.getitem(name)" would be the way
to access "name" without rendering in the first place.
But once, it is cached, you will get the cached value.

You can try "_.getattr(this(),portal_url)".
This way, you use explicite acquisition from the "current object"
("this()") to access "portal_url".


-- 
Dieter



More information about the Zope mailing list