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
-----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 tseaver@palladion.com Palladion Software "Excellence by Design" http://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-----
participants (2)
-
rishi pathak -
Tres Seaver