Hi I'm a bit of a Zope newbie and I've been scouring various documentations on how to open and print the contents of a file using a python script. I tried the following code but it didn't work: fd = context.open('file','r') print fd I get an AttributeError. I'm sure a lot of you have done this so I hope to hear from you guys soon. Thanks -RR- _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 25 June 2002 18:49, Roberto Rivero wrote:
Hi I'm a bit of a Zope newbie and I've been scouring various documentations on how to open and print the contents of a file using a python script.
hmm. I'm not sure what you exactly mean by the term 'file'. I think you mean an object in the zope database (ZODB). to create an object in the ZODB try this: - --------- snip --------- # create a new file object container.manage_addProduct["OFSP"].manage_addDTMLMethod("myDtml",title="myTitle") # push some data into it container.myDtml.manage_edit("hello, world", container.myDtml.title) # print the data print container.myDtml() return printed - --------- snap --------- note that you created an object called DTML method. You may need other kinds of objects, depending on your task...
I tried the following code but it didn't work: fd = context.open('file','r') print fd
I get an AttributeError.
Access to the 'real' filesystem is from zope limted for security reasons. if you _really_ need access to the filesystem you have to create an 'external method'. mfg AND - -- I doubt, therefore I might be. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9GcG5hlekfiEFJv4RAt91AKCSWuWEnVqfdrl9h7w7/Pvow27eVQCgyvVb j1jtNgPd1r/PERrMIC9wa9A= =nYHz -----END PGP SIGNATURE-----
participants (2)
-
Andreas Lauser -
Roberto Rivero