passing script parameters - newbie question
I have a Python script that takes a parameter 'fileid' which is a file id. I need to call the getProperty() method via something like this: container.fileid.getProperty('prop') This does not work (I get an Attribute Error). Can anyone help? Paul
On Sun, Dec 28, 2003 at 02:11:33AM -0700, Paul Dumais wrote:
I have a Python script that takes a parameter 'fileid' which is a file id. I need to call the getProperty() method via something like this:
container.fileid.getProperty('prop')
This does not work (I get an Attribute Error).
yes, you probably want this: getattr(container, fileid).getProperty('prop') -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's CUSTODIAN TERRIBLE TONGUE! (random hero from isometric.spaceninja.com)
try something like this: obj = getattr(container, fileid, None) if obj and obj.hasProperty('prop'): return obj.getProperty('prop') return 'either object or property not found' HTH Robert On Sunday 28 December 2003 10:11, Paul Dumais wrote:
I have a Python script that takes a parameter 'fileid' which is a file id. I need to call the getProperty() method via something like this:
container.fileid.getProperty('prop')
This does not work (I get an Attribute Error).
Can anyone help?
Paul
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Paul Dumais -
Paul Winkler -
robert