Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File download problem #18

Closed
dndred opened this issue Nov 8, 2012 · 2 comments
Closed

File download problem #18

dndred opened this issue Nov 8, 2012 · 2 comments

Comments

@dndred
Copy link

dndred commented Nov 8, 2012

Sorry my Google translate.
I had a problem with downloading files. Something like "file object has no method getvalue()". Perhaps this patch is not the best solution as a huge file will be fully loaded into memory.

--- a/muntjac/terminal/gwt/server/abstract_application_servlet.py
+++ b/muntjac/terminal/gwt/server/abstract_application_servlet.py
@@ -725,8 +725,8 @@ class AbstractApplicationServlet(PasteWsgiServlet, Constants):
                         + stream.getFileName() + '\"')
                 self.setHeader(response, 'Content-Disposition',
                         contentDispositionValue)
-
-            self.write(response, data.getvalue())
+                        
+            self.write(response, data.read())
             data.close()
rwl added a commit that referenced this issue Nov 9, 2012
@rwl
Copy link
Owner

rwl commented Nov 9, 2012

The use of getvalue was due to data perhaps being a StringIO. I've added your change, but can you please test it out.

@dndred
Copy link
Author

dndred commented Nov 9, 2012

from muntjac.terminal.file_resource import FileResource
myResource = FileResource('/path/to/file', app)
app.getWindows()[0].open(myResource)

It's work fine.

@rwl rwl closed this as completed Nov 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants