[Zope] Re: Attribute Error with Container
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Tue, 22 Apr 2003 19:29:31 +0200
Mark Nenadov wrote:
> Hello all,
>
> I'm trying to make a Python script that checks the value of ZClass
> property (within a property sheet).
>
> What I am doing is very similar to the example implementation of
> "isHungry" in "The Zope Book".
>
> However, I am getting an error (error type: Attribute Error, and error
> value: SensoryProperties), when I try something equivalent to the
> following:
>
> if (container.SensoryProperties.taste == "good"):
> return 1
> else:
> return 0
>
> Does anyone have a clue what this might be? I assume that since
> "container" is a bound name I don't need to do anything special to
> "enable" it.
Hi,
have a look at the bindings-tab of a PythonScript to understand what
these "magical" bindings mean.
container = objectmanager in which your PythonScript lives.
But you should use context:
context = the object which your PythonScript is called on.
if (context.SensoryProperties.taste == "good"):
return 1
else:
return 0
Cheers, Maik