-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/master Date: 2021-06-23T17:00:07+02:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/Products.PlonePAS@8ea26dd Pillow 8 support Files changed: A news/61.bugfix M src/Products/PlonePAS/utils.py Repository: Products.PlonePAS Branch: refs/heads/master Date: 2021-06-23T21:06:12+02:00 Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl> Commit: plone/Products.PlonePAS@e2900c1 Merge pull request #61 from plone/pillow-8 Pillow 8 support Files changed: A news/61.bugfix M src/Products/PlonePAS/utils.py
- Loading branch information
1 parent
1030092
commit 0b43de6
Showing
1 changed file
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
Repository: plone.formwidget.namedfile | ||
Repository: Products.PlonePAS | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2021-06-23T16:45:15+02:00 | ||
Date: 2021-06-23T17:00:07+02:00 | ||
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> | ||
Commit: https://github.com/plone/plone.formwidget.namedfile/commit/88270f7881e17adb86d702a6e5f18cf613811b50 | ||
Commit: https://github.com/plone/Products.PlonePAS/commit/8ea26dd743f38c4af62c5121f637ec051747054a | ||
|
||
pillow 9 exception is different | ||
Pillow 8 support | ||
|
||
Files changed: | ||
A news/50.bugfix | ||
M plone/formwidget/namedfile/widget.rst | ||
A news/61.bugfix | ||
M src/Products/PlonePAS/utils.py | ||
|
||
b'diff --git a/news/50.bugfix b/news/50.bugfix\nnew file mode 100644\nindex 0000000..d8aac5a\n--- /dev/null\n+++ b/news/50.bugfix\n@@ -0,0 +1 @@\n+Support for Pillow 8 in tests. [jensens]\ndiff --git a/plone/formwidget/namedfile/widget.rst b/plone/formwidget/namedfile/widget.rst\nindex a8fa0f2..0eb3060 100644\n--- a/plone/formwidget/namedfile/widget.rst\n+++ b/plone/formwidget/namedfile/widget.rst\n@@ -752,10 +752,11 @@ Check that we have a good image that PIL can handle::\n \n Note that PIL cannot open this bytes image, so we cannot scale it::\n \n- >>> PIL.Image.open(six.BytesIO(content.image_field))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n+ >>> try:\n+ ... PIL.Image.open(six.BytesIO(content.image_field))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n \n Prepare for a new request cycle::\n \n' | ||
b'diff --git a/news/61.bugfix b/news/61.bugfix\nnew file mode 100644\nindex 00000000..2a794d67\n--- /dev/null\n+++ b/news/61.bugfix\n@@ -0,0 +1 @@\n+Support for Pillow 8. [jensens]\ndiff --git a/src/Products/PlonePAS/utils.py b/src/Products/PlonePAS/utils.py\nindex 12c183b2..4f287dda 100644\n--- a/src/Products/PlonePAS/utils.py\n+++ b/src/Products/PlonePAS/utils.py\n@@ -44,7 +44,7 @@ def scale_image(image_file, max_size=None, default_format=None):\n \n >>> from Products.PlonePAS import config\n >>> import os\n- >>> from six import StringIO\n+ >>> from six import BytesIO\n >>> from Products.PlonePAS.utils import scale_image\n >>> from PIL import Image\n \n@@ -61,19 +61,22 @@ def scale_image(image_file, max_size=None, default_format=None):\n We\'ll also make some evil non-images, including one which\n masquerades as a jpeg (which would trick OFS.Image)::\n \n- >>> invalid = StringIO(\'<div>Evil!!!</div>\')\n- >>> sneaky = StringIO(\'\\377\\330<div>Evil!!!</div>\')\n+ >>> invalid = BytesIO(\'<div>Evil!!!</div>\'.encode("utf-8"))\n+ >>> sneaky = BytesIO(\'\\377\\330<div>Evil!!!</div>\'.encode("utf-8"))\n \n OK, let\'s get to it, first check that our bad images fail:\n \n- >>> scale_image(invalid, (50, 50))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n- >>> scale_image(sneaky, (50, 50))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n+ >>> try:\n+ ... scale_image(invalid, (50, 50))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n+\n+ >>> try:\n+ ... scale_image(sneaky, (50, 50))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n \n Now that that\'s out of the way we check on our real images to make\n sure the format and mode are preserved, that they are scaled, and that they\n' | ||
|
||
Repository: plone.formwidget.namedfile | ||
Repository: Products.PlonePAS | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2021-06-23T21:04:03+02:00 | ||
Date: 2021-06-23T21:06:12+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl> | ||
Commit: https://github.com/plone/plone.formwidget.namedfile/commit/fa035fdf4bad4ae26cce7d8e73f6c58a24b9be97 | ||
Commit: https://github.com/plone/Products.PlonePAS/commit/e2900c1caba0462152867059c2f261f02b6a3821 | ||
|
||
Merge pull request #50 from plone/pillow-8 | ||
Merge pull request #61 from plone/pillow-8 | ||
|
||
pillow 8 exception is different | ||
Pillow 8 support | ||
|
||
Files changed: | ||
A news/50.bugfix | ||
M plone/formwidget/namedfile/widget.rst | ||
A news/61.bugfix | ||
M src/Products/PlonePAS/utils.py | ||
|
||
b'diff --git a/news/50.bugfix b/news/50.bugfix\nnew file mode 100644\nindex 0000000..d8aac5a\n--- /dev/null\n+++ b/news/50.bugfix\n@@ -0,0 +1 @@\n+Support for Pillow 8 in tests. [jensens]\ndiff --git a/plone/formwidget/namedfile/widget.rst b/plone/formwidget/namedfile/widget.rst\nindex a8fa0f2..0eb3060 100644\n--- a/plone/formwidget/namedfile/widget.rst\n+++ b/plone/formwidget/namedfile/widget.rst\n@@ -752,10 +752,11 @@ Check that we have a good image that PIL can handle::\n \n Note that PIL cannot open this bytes image, so we cannot scale it::\n \n- >>> PIL.Image.open(six.BytesIO(content.image_field))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n+ >>> try:\n+ ... PIL.Image.open(six.BytesIO(content.image_field))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n \n Prepare for a new request cycle::\n \n' | ||
b'diff --git a/news/61.bugfix b/news/61.bugfix\nnew file mode 100644\nindex 00000000..2a794d67\n--- /dev/null\n+++ b/news/61.bugfix\n@@ -0,0 +1 @@\n+Support for Pillow 8. [jensens]\ndiff --git a/src/Products/PlonePAS/utils.py b/src/Products/PlonePAS/utils.py\nindex 12c183b2..4f287dda 100644\n--- a/src/Products/PlonePAS/utils.py\n+++ b/src/Products/PlonePAS/utils.py\n@@ -44,7 +44,7 @@ def scale_image(image_file, max_size=None, default_format=None):\n \n >>> from Products.PlonePAS import config\n >>> import os\n- >>> from six import StringIO\n+ >>> from six import BytesIO\n >>> from Products.PlonePAS.utils import scale_image\n >>> from PIL import Image\n \n@@ -61,19 +61,22 @@ def scale_image(image_file, max_size=None, default_format=None):\n We\'ll also make some evil non-images, including one which\n masquerades as a jpeg (which would trick OFS.Image)::\n \n- >>> invalid = StringIO(\'<div>Evil!!!</div>\')\n- >>> sneaky = StringIO(\'\\377\\330<div>Evil!!!</div>\')\n+ >>> invalid = BytesIO(\'<div>Evil!!!</div>\'.encode("utf-8"))\n+ >>> sneaky = BytesIO(\'\\377\\330<div>Evil!!!</div>\'.encode("utf-8"))\n \n OK, let\'s get to it, first check that our bad images fail:\n \n- >>> scale_image(invalid, (50, 50))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n- >>> scale_image(sneaky, (50, 50))\n- Traceback (most recent call last):\n- ...\n- OSError: cannot identify image file...\n+ >>> try:\n+ ... scale_image(invalid, (50, 50))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n+\n+ >>> try:\n+ ... scale_image(sneaky, (50, 50))\n+ ... except Exception as e:\n+ ... print(e)\n+ cannot identify image file...\n \n Now that that\'s out of the way we check on our real images to make\n sure the format and mode are preserved, that they are scaled, and that they\n' | ||
|