don't mind the "It just stops" in my previous post. Forgot to remove
it.

On Jul 7, 2:55 pm, Bob Messiaen <[email protected]> wrote:
> Hi,
>
> We use turbogears2 via cherrypy. I know this setup is not very common.
>
> I did a capture with wireshark and saw nothing strange:
> All expected packets were being transferred from the device running
> the web app to my pc.
> No communication errors, ...
> This all happens before you can choose where to store the file.
> If you then wait +- 10 seconds, select a location and press "save",
> the problem occurs
> IE  stops saving the file after 1 second (94 kb downloaded in 1
> second ...).
>
> As for the generator: It doesn't seem to fail. Never got an exception
> when i put a try/except arround it.
> It just stops
>
> If the data is returned at once, it works ok in all cases.
>
> Bob
>
> On Jul 6, 6:39 pm, "Diez B. Roggisch" <[email protected]> wrote:
>
> > On Tuesday, July 06, 2010 11:54:34 Bob Messiaen wrote:
>
> > > Hi,
>
> > > I'm having problems with downloading a large file with internet
> > > explorer (IE8 in my case).
> > > Once the "File download" dialog appears and you choose Save, you can
> > > point the location where to save the file. Depending on how much time
> > > i spend, selecting the "save to" location, my file gets only partially
> > > saved.
>
> > > works ok with other browsers.
>
> > > The response i'm creating is not a string but a generator.
> > > As i have spend some time looking for a solution i ran into this
> > > article which probably has something to do with my problem:
> > >http://www.cherrypy.org/wiki/ReturnVsYield
>
> > > Some of the code i'm using.
> > > Controller code:
>
> > >   @expose()
> > >   @handle_exception('/configuration/device/backup')
> > >   def export(self, **kwargs):
>
> > >     return filedownloader(octet_stream = file_content,
> > >                           filename     = "test.tgz",
> > >                           content_type = 'application/x-gzip')
> > >   export._cp_config = {'response.stream': True}
>
> > > filedownloader:
>
> > > from itertools import izip_longest
> > > def grouper(n, iterable, fillvalue=None):
> > >   "grouper(3, 'ABCDEFG', 'x') -->  ABC DEF Gxx"
> > >   args = [iter(iterable)] * n
> > >   return izip_longest(fillvalue=fillvalue, *args)
>
> > > def string_chunks(octet_stream, chunck_size):
> > >   for chunk in grouper(chunck_size, octet_stream):
> > >     yield "".join(x for x in chunk if x is not None)
>
> > > def filedownloader(octet_stream, filename='output.txt',
> > > content_type='text/plain', chunck_size=8192*2, inline=False):
> > >   addFileDownloadHeaders(content_type, filename, inline)
> > >   return string_chunks(octet_stream, chunck_size)
>
> > > I'm using CherryPy 3.1.2, Turbogears 2.1
>
> > This makes no sense to me - TG2.1 has nothing todo with Cherrypy.
>
> > From what I gather, the problem seems to occur if the generator fails. I
> > suggest you put a proxy like tcpmon in between your browser & webapp, and 
> > see
> > what goes over the wire. Also, what happens if you return the data at once,
> > and what happens if you put exception-catching code around the generator, 
> > and
> > dump whatever exception is created to some logfile.
>
> > Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to