-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature download files #101
Feature download files #101
Conversation
Added that in the latest commit. Good point.
Well, I am not entirely happy with it either but I had no good alternative idea yet. One obvious option would be to store all files as a flat structure in the ZIP. Duplicated filenames would have to been handled. Probably like |
9a0d84a
to
58b8a50
Compare
|
a0c69b9
to
e6dce1d
Compare
I will try to work around that failing |
e6dce1d
to
e9a18a0
Compare
I am currently struggling to get the high score on those Travis checks ;-) |
e9a18a0
to
058536a
Compare
I have marked the failing tests to be skipped because the problem is obviously not in Sacredboard. |
sacredboard/app/webapi/files.py
Outdated
file = dao_files.get(file_id) | ||
data = zipfile.ZipInfo(file.filename) | ||
file: gridfs.GridOut = dao_files.get(file_id) | ||
data = zipfile.ZipInfo(file.filename, date_time=file.upload_date.timetuple()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone writes implementation for a non-mongoDB backend? There would be no gridfs.
Do you think you could wrap the result of the get
method to something more generic?
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean but I think it is generic in a way by seeing it as duck typing. The returned file
object should have the attributes filename
, upload_date
and read()
. So another backend would have to return an object that also provides these attributes and it should work.
In any case the variable annotation from file: gridfs.Gridout
is gone already (mainly because Python 3.6 but you are right that it would not be generic).
Ofc I can still change it if you want. For example to a dict
as it is done in the metricsdao.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'm fine with duck typing (I didn't realise that timetuple()
is a method of datetime
).
But I'd like to see it documented somewhere (e.g. as a docstring in the FilesDAO
class or as a unit test checking whether the returned object is really a "duck" :-) ) - just to make it clear to other developers who would eventually implement it for another back-end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point. I added that information to the docstring of the abstract class.
058536a
to
6086fab
Compare
6086fab
to
255cdc2
Compare
255cdc2
to
273c4d9
Compare
Adds viewing and downloading source and artifact files.
Solves #81 and #91