[Zope-dev] getattr in a PythonMethod

Evan Simpson evan@4-am.com
Wed, 23 Feb 2000 19:53:41 -0600


Kevin Dangoor wrote:

> From: "Kevin Littlejohn" <darius@connect.com.au>
> > (Noting you can already do the same thing with self['x_db'[1:]] anyway,
> but
> > it's assumed nothing valuable lives there ;)
>
> Interesting... there's the answer to my question.
>
> dtml = self['popular.html']
>
> does just what I need :)

As long as 'popular.html' lives in the same folder as the PM, yes.  Otherwise
you'll want to use self.aq_acquire('popular.html'), which works in both
cases.  If you're trying to get an attribute of something which doesn't
support acquisition or index notation, you're out of luck :-(

getattr is broken because I can't allow use of the builtin getattr (for the
reasons Kevin explains) and the careful_getattr I *do* provide tries to call
validate all the time, and I haven't yet figured out what it wants.

Cheers,

Evan @ 4-am & digicool