On Tuesday 16 October 2001 11:38 am, Lars Heber allegedly wrote:
After receiving a snippet of python script, I finally decided to have a closer look at that language, and I was surprised how simple and comfortable it is. I think I'll like it! But: Where can I find a reference for the objects I can use in those scripts? I received the following snippet:
try: my_index = context.dirIndex. except: my_index = 0
But I only want my_index to become 0 when the object and ONLY then object, i. e. without acquisition, has the prop dirIndex. s. th. like in DTML: <dtml-if "_.hasattr(aq_explicit,'dirIndex')">
Can anyone help me please? Where can I get information about python script? I looked at python.org, but didn't find what I was looking for...
TIA
If this is a property (as opposed to a general attribute) then use the built in hasProperty method: context.hasProperty('dirIndex') Acquisition won't be an issue. I'm glad to hear you like Python, you're soaking in it! 8^) /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/