[Zope-dev] Will restrictedTraverse() load every obj into memory?

Andy McKay andy at agmweb.ca
Thu Sep 18 00:14:49 EDT 2003


Yes, thats what the catalog is for.

zhimin at iss.nus.edu.sg wrote:
> Hello,
> 
> I have a function that returns the object when given a path.
> 
> def path2Object(path):
>     obj = context,restrictedTraverse(path)
>     return obj
> 
> My concern is whether restrictedTraverse(path) will load into memory every
> object it traverses through and thus increase memory usage, especially if
> it is run very frequently and with different path each time.
> e.g. if my path is '/x/y/z/myobj',  will object x, y, and z also get loaded
> when the object I really want is myobj? What's the state of x,y,z after
> calling restrictedTraverse(path) - loaded or ghost?
> 
> If intermediate objects (like x, y, z above) get loaded, is there anyway to
> ghostify them to reduce memory usage?
> ...or is there a memory-economic way to get object by path?
> 
> Many thanks!
> 
> 
> cheers,
> Zhi Min
> 
> 
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
> 

-- 
   Andy McKay
   http://www.agmweb.ca




More information about the Zope-Dev mailing list