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

Dieter Maurer dieter@handshake.de
Thu, 14 Nov 2002 21:03:04 +0100


Andreas Tille writes:
 > ...
 > > >     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.
This is almost surely not the case:

  1.  The "if" line cannot raise an "AttributeError 'dynscript'".

  2.  The "foundname.dynscript" will as a string does not have
      an Attribute "dynscript".

Check again. You will see that the suggestion was right.


Dieter