[Zope] Re: Properties of File objects in python script

Andreas Tille tillea@rki.de
Wed, 13 Nov 2002 17:09:07 +0100 (CET)


On Wed, 13 Nov 2002, Felix Ulrich-Oltean wrote:

> On Wed, Nov 13, 2002 at 03:50:44PM +0100, Andreas Tille wrote:
> >     name = "<some parameter of the script>"
> >     cont = container.content
> >
> >     for file in cont.objectValues('File'):
> >         if name == file.getId():
> >             foundname=name
> >             foundfile=file
> >             break
> >
> >     if foundfile.hasProperty('dynscript') :
> >         return foundname.dynscript
> >
>
> Shouldn't the last line say:
>
> return foundfile.dynscript
No.

> You are checking whether foundfile has the property 'dynscript', but
> the returning foundscript.dynscript
Just imagine there would be a

       return 'Hello World'

The problem is that the error occures in the if condition.

Kind regards

      Andreas.