[Zope] Introspection and Zope
Dieter Maurer
dieter@handshake.de
Wed, 28 Nov 2001 19:56:44 +0100
Douwe Osinga writes:
> > You mix attribute access syntax and subscription syntax.
> I must admit that I'm not so sure about the difference
>
> > I do not know why it works for "absolute_url" but it is not a good
> > idea in general.
> > Try: "getattr(context,propname)()"
> I did that too and it gives the same result. Resource not found. The
> strange thing is that
>
> method = getattr(context,propname)
>
> in itself does not fail. But as soon as I try to do anything with method,
> I get the error.
That indicates, that your method call needs context that you do not
provide!
If your method, e.g., would be a DTML method, then you must pass
either a client object or (inclusive) a mapping object that gives
the DTML method access to Zope objects (if it needs such access).
For DTML objects, you may read "Calling DTML objects" in
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
to learn about the details.
Dieter