Hi all,

Thanks to the tips I got yesterday I switched my application design to 
stream the contents of my files into memory rather than trying to write my 
file to disk twice (invoking FileStorage.save() twice).

To get the data from the FileStorage object into a buffer for processing, I 
decided to use the stream() method to get an input stream to the data that 
I could read from. But again, after using the stream.read() method to read 
a few bytes from the FileStorage object, the file pointer was advanced and 
thus when I used FileStorage.save() later, my file was again truncated. I 
fixed this by using seek() to reset the input stream back to the beginning 
before using save().

To me, it still seems to make sense to reset the file pointer to the 
beginning before calling shutilcopyfileobj in the FileObject.save() method 
so that you can guarantee that you'll always save the entire file to disk, 
regardless of what you've done with the input stream.

Is there any downside to making this change in the library?

Thanks,
Walter

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pocoo-libs/-/6VWJUyFv6wYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to