-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
More Python 3 fixes #25
Conversation
There is already a relevant changelog line |
) | ||
zf.close() | ||
zf.writestr( | ||
'/'.join([self.__name__, path, ]), |
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.
The zipfile docs say: "There is no official file name encoding for ZIP files. If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write()."
Since directory listings are strings in Python 3 I think that means we need to encode the names for zipfile in Python 3 -- but I haven't actually tested.
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.
@davisagli thanks for your precious review!
It seems tests are running fine.
[ale@emily plone3]$ .tox/py36/bin/test -s plone.resource
...
Total: 79 tests, 0 failures, 0 errors, 0 skipped in 8.572 seconds.
Indeed I do not think in the tests we have paths with fancy unicode characters.
Also that note is for the filename
parameter of the write
method: https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile.write
On the other way some lines after we read: "zinfo_or_arcname is either the file name it will be given in the archive, or a ZipInfo instance."
I set this one in progress and will add a new test to sort this out!
This will only work in Plone 5.2 (due to changes in OFS.Image in Zope 4), so we'll need a legacy-branch for Plone 5.0 and 5.1. |
branch 2.0.x is for 5.0 and 5.1, branch master (next release will be 2.1.0) for 5.1 |
No description provided.