[Zope] python script ques

Aseem Mohanty aseem@neurobehavioralsystems.com
Mon, 10 Jun 2002 21:15:56 -0700


Thanks Michal,

I am still kind of new at Zope so did not use Catalogs. I however found 
that the " hsattr(container, object) " function seems to work out fine. 
Had to search in the source for it but found it. I will try the Catalog 
option and see how it works out.

Thanks again,
AM

Michal Bencur wrote:

>Hi Aseem,
>
>maybe this helps:
>
>if 'help' in context.objectIds():
>
>but I think this is slow if there are many objects in a folder, so I use Catalog and something like this:
>
>if context.myCatalog({'id': 'help'}):
>
>
>Michal
>
>On Mon, Jun 10, 2002 at 12:03:33AM -0700, Aseem Mohanty wrote:
>
>>Hi all,
>>
>>If I want to know whether or not an object bound to the 'context' 
>>variable in Python Script has a specific child, how do I do it?
>>
>>For e.g.
>>
>>PScript:
>>get_help(topic):
>>    if context.[has_child]('help'):
>>        if context.help.[has_child](topic):
>>           path = context.help.absolute_url() + '/topic"
>>    else:
>>            path = None
>>    return path
>>
>>Is there a "has_child" function? I tried to do some stuff with traversal 
>>but failed miserable (probably didnt understand it well enuff).
>>TIA
>>AM
>>
>>
>>-- 
>>==================================================================
>> Aseem Mohanty							   
>> Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
>> (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
>>==================================================================								  	
>> "I saw `cout' being shifted "Hello world" times to the left and  
>>  stopped right there!!"                        -- Steve Gonedes  
>>================================================================== 
>>
>>
>>
>>
>>_______________________________________________
>>Zope maillist  -  Zope@zope.org
>>http://lists.zope.org/mailman/listinfo/zope
>>**   No cross posts or HTML encoding!  **
>>(Related lists - 
>> http://lists.zope.org/mailman/listinfo/zope-announce
>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>
>
>

-- 
==================================================================
 Aseem Mohanty							   
 Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
==================================================================								  	
 "I saw `cout' being shifted "Hello world" times to the left and  
  stopped right there!!"                        -- Steve Gonedes  
==================================================================