-
Notifications
You must be signed in to change notification settings - Fork 163
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
Cleanup export temp attachment files #1326
base: master
Are you sure you want to change the base?
Commits on Jun 3, 2014
-
Changed create_attachments_zipfile() to stop leaving behind zip files…
… in the system tmp folder which never get cleaned up, and have it return a data stream of the zip file contents intead. Next up: fix the two places in the rest of the code which were calling this, and adapt them to use the data stream in lieu of the file name.
Denis Papathanasiou committedJun 3, 2014 Configuration menu - View commit details
-
Copy full SHA for cff4bd2 - Browse repository at this point
Copy the full SHA cff4bd2View commit details -
Changed utils.export_tools.generate_attachment_zip_export(),
the first caller of create_attachments_zipfile(), to treat the result as a data stream, and catch and record any IOErrors as failed Export objects in the database. The prior logic was disgusting: it created a zip file in /tmp, read it into memory to create a new file (a copy) elsewhere in the filesystem, and never bothered with the original file in /tmp.
Denis Papathanasiou committedJun 3, 2014 Configuration menu - View commit details
-
Copy full SHA for fb032db - Browse repository at this point
Copy the full SHA fb032dbView commit details -
Changed zip_export(), the second caller of create_attachments_zipfile…
…(), to accept the result back as a stream, and used django's FileWrapper to respond to the http request immediately, rather than calling another to go read the temp file first (which, of course, never gets cleaned up). The response_with_mimetype_and_name() function in utils.export_tools.py is just a mess: it depends on reading all its responses from the file system, and mimetype assumption that all valid response types start with 'application/' is just flat wrong!
Denis Papathanasiou committedJun 3, 2014 Configuration menu - View commit details
-
Copy full SHA for 1c7a386 - Browse repository at this point
Copy the full SHA 1c7a386View commit details
Commits on Jun 5, 2014
-
Corrected assertion in zip file export test to match the full content…
… disposition string, which should include the filename (xform id string).
Denis Papathanasiou committedJun 5, 2014 Configuration menu - View commit details
-
Copy full SHA for ada9b77 - Browse repository at this point
Copy the full SHA ada9b77View commit details -
Changed create_attachments_zipfile() to return a handle to the tempor…
…ary file-like object corresponding to the zipped file, rather than the entire data stream of the file contents, since it is safer for the functions which invoke it to handle it themselves. As with the previous revision, this function does *not* leave files in /tmp after the request is completed.
Denis Papathanasiou committedJun 5, 2014 Configuration menu - View commit details
-
Copy full SHA for e401c56 - Browse repository at this point
Copy the full SHA e401c56View commit details -
Updated zip_export() to use the file-like object handle of the zip fi…
…le, rather than the full data stream of the prior version.
Denis Papathanasiou committedJun 5, 2014 Configuration menu - View commit details
-
Copy full SHA for 660fb7e - Browse repository at this point
Copy the full SHA 660fb7eView commit details -
Updated generate_attachments_zip_export() to use the file-like object…
… handle of the zip file, rather than the full data stream of the prior version.
Denis Papathanasiou committedJun 5, 2014 Configuration menu - View commit details
-
Copy full SHA for e0a57fc - Browse repository at this point
Copy the full SHA e0a57fcView commit details