[Zope] Properties of File objects in python script

Andreas Tille tillea@rki.de
Wed, 13 Nov 2002 15:50:44 +0100 (CET)


Hi,

the Zope Book says that I can check properties of objects via

         if object.hasProperty('siteMap') and object.siteMap:
              results.append(object)

for instance.  I just added a property 'dynscript' with the type
String to some File objects and wanted to do some action if a File
object just has such a property.  So I did:

    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


--> Zope has encountered an error while publishing this resource.

    Error Type: AttributeError
    Error Value: dynscript

Could anybody enlighten my why the example from the Zope book does not
apply for my application?

Kind regards

         Andreas.