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

2003-09-17 Thread zhimin
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  -  [EMAIL PROTECTED]
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 )


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

2003-09-17 Thread Andy McKay
Yes, thats what the catalog is for.

[EMAIL PROTECTED] 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  -  [EMAIL PROTECTED]
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
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )