[Zope] python script ques

Michal Bencur zope@benko.sk
Tue, 11 Jun 2002 10:13:34 +0200


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 )