I already know (1) and (2). Actually in this two cases we don't need
to do stream by ourselves. Recently I am trying to use web2py to
develop a "desktop app", which need to stream files in anywhere on
local hard disk. So not in range of (1) or (2), and even (3) is
misleading in this case.

So, add one more stream example please. :-)

On Apr6, 0:13am, mdipierro <[email protected]> wrote:
> Now I understand better. I agree that example needs revision but:
> 1) files in static are automatically served properly (in a way that
> supports 206)
> 2) dowloading uploaded files too (if you use response.download())
> 3) the purpose of that example is also to show that you can stream any
> output stream (something with a read() method) not necessarily and
> actual file (for example a StringIO).
>
> perhaps we need to add one example.
>
> Massimo
>
> On Apr 5, 10:26 am, Iceberg <[email protected]> wrote:
>
> > Sorry, chunk_size does not matter in this case. What I mean is, using
> > a file object as the first parameter of response.stream(...) does NOT
> > support "HTTP/1.1
> > 206 PARTIAL CONTENT". Instead, we should use a file name string.
> > Therefore I suggest to adjust the example document to explicitly
> > compare the two approaches. I refine the doc, please refer to the end
> > of this mail.
>
>
> > > > ============ START =============
> > > > Example 48
>
> > > > It is very easy in web2py to stream large files. Here is an example of
> > > > a controller that does so:
>
> > > > def streamer():
> > > >     return response.stream(open('largefile.mpg4','rb'))
> > > > By default all static files and files stored in 'upload' fields in the
> > > > database are streamed when larger than 1MByte.
>
> > > > Even better, if you use:
> > > > def streamer():
> > > >     return 
> > > > response.stream('a_file_name_rather_than_a_file_object.mpg4',request=reques
> > > >  t)
>
> > > > web2py automatically and transparently handles PARTIAL_CONTENT and
> > > > RANGE requests.
>
> > > > ========== THE END ===============
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to