Re: [Zope] Convert absolute path to File object

2008-10-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

rishi pathak wrote:
 In a script python I need to a read a File stored in ZODB at some location.
 In the said script I only have
 absolute path of File object as string for e.g. '/path/to/file/object'
 
 The only way seems is to convert path string so that it can be accessed
 using container.path.to.file.object.data
 
 Can anyone suggest a method to do so.

In Zope2, use restrictedTraverse, e.g.:

  container.restrictedTraverse('/path/to/file/object')

The leading '/' will cause the path traversal to happen from the ZODB root.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI9zcV+gerLs4ltQ4RAv8LAJ0cNO3nBP8DfI3Fx1ShRDlfaSreLwCgiy2i
biVGUYDdx5KNjcJIE56Q68M=
=9czs
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Convert absolute path to File object

2008-10-16 Thread rishi pathak
In a script python I need to a read a File stored in ZODB at some location.
In the said script I only have
absolute path of File object as string for e.g. '/path/to/file/object'

The only way seems is to convert path string so that it can be accessed
using container.path.to.file.object.data

Can anyone suggest a method to do so.



-- 
Regards--
Rishi Pathak
Pune-Maharastra
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )