Re: [Zope] Reading File Object in Script (Python)

2006-09-07 Thread Dieter Maurer
Ferhat Ayaz wrote at 2006-9-7 01:20 -0700:
> ...
>I want to read a File object from ZODB. How can I read
>the content of the uploaded File object?

Reading a "File" object from ZODB is *VERY* different from
reading a "ZPublisher.HTTPRequest.FileUpload" object.

A "File" object has its data in an attribute named "data".
If the "File" is larger, then "data" is not a string but a
complex data structure (a linked list of "pdata" objects).
You can use "str(File.data)" to get the complete content.

A "FileUpload" object on the other hand behaves very much
like a Python "file" object. Especially, you can use "read",
"tell", "seek", ...

>I must to read it line by line with readlines()

For "FileUpload", readline will probably work too. But I am not
sure. Try it out...



-- 
Dieter
___
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 )


Re: [Zope] Reading File Object in Script (Python)

2006-09-07 Thread Andreas Jung



--On 7. September 2006 01:20:53 -0700 Ferhat Ayaz <[EMAIL PROTECTED]> 
wrote:



Hi,

I want to read a File object from ZODB. How can I read
the content of the uploaded File object?


Use the read() method.


I must to read it line by line with readlines().


Use read() and split() the data if necessary.


-aj

pgpqt8Utc7B9D.pgp
Description: 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] Reading File Object in Script (Python)

2006-09-07 Thread Ferhat Ayaz
Hi,

I want to read a File object from ZODB. How can I read
the content of the uploaded File object?
I must to read it line by line with readlines()
Can you show a little code block how to do this?

Thanks and greets,
Ferhat


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
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 )