-
-
Notifications
You must be signed in to change notification settings - Fork 75
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/4.2.x Date: 2018-11-05T21:10:24+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@82c9caf Do not fail image upload when Exif data is bad. plone/plone.namedfile#68 Files changed: M plone/namedfile/file.py Repository: plone.namedfile Branch: refs/heads/4.2.x Date: 2018-11-05T22:08:30+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.namedfile@2f553c5 Forgot to commit news file Files changed: A news/68.bugfix Repository: plone.namedfile Branch: refs/heads/4.2.x Date: 2018-11-09T00:32:47+01:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.namedfile@d7163c4 Merge pull request #70 from plone/issue-68-branch42 Do not fail image upload when Exif data is bad. [4.2] Files changed: A news/68.bugfix M plone/namedfile/file.py
- Loading branch information
Showing
1 changed file
with
27 additions
and
57 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,80 +1,50 @@ | ||
Repository: plone.api | ||
Repository: plone.namedfile | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-10-16T13:14:16+02:00 | ||
Author: tschorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.api/commit/0a6d80a9a984b1d573e23336b383823d10003fac | ||
Branch: refs/heads/4.2.x | ||
Date: 2018-11-05T21:10:24+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.namedfile/commit/82c9caf14e7fc38024305d3ac42d7c805eb42ed8 | ||
|
||
show only local roles when inherit=False | ||
Do not fail image upload when Exif data is bad. | ||
|
||
Files changed: | ||
M src/plone/api/group.py | ||
M src/plone/api/tests/test_group.py | ||
|
||
b'diff --git a/src/plone/api/group.py b/src/plone/api/group.py\nindex a7b4b43..be8d50f 100644\n--- a/src/plone/api/group.py\n+++ b/src/plone/api/group.py\n@@ -216,6 +216,8 @@ def get_roles(groupname=None, group=None, obj=None, inherit=True):\n :type group: GroupData object\n :param obj: If obj is set then return local roles on this context.\n :type obj: content object\n+ :param inherit: Show only local roles if False\n+ :type inherit: boolean\n :raises:\n ValueError\n :Example: :ref:`group_get_roles_example`\n@@ -239,17 +241,12 @@ def get_roles(groupname=None, group=None, obj=None, inherit=True):\n else:\n # get only the local roles on a object\n # same as above we use the PloneUser version of getRolesInContext.\n- # Include roles inherited from being the member of a group\n- # and from adapters granting local roles\n- plone_user = super(group.__class__, group)\n- principal_ids = list(plone_user.getGroups())\n- principal_ids.insert(0, plone_user.getId())\n+ # Include roles from adapters granting local roles\n roles = set([])\n pas = portal.get_tool(\'acl_users\')\n for _, lrmanager in pas.plugins.listPlugins(ILocalRolesPlugin):\n for adapter in lrmanager._getAdapters(obj):\n- for principal_id in principal_ids:\n- roles.update(adapter.getRoles(principal_id))\n+ roles.update(adapter.getRoles(group_id))\n return list(roles)\n \n \ndiff --git a/src/plone/api/tests/test_group.py b/src/plone/api/tests/test_group.py\nindex 8c96ec9..e2dc59d 100644\n--- a/src/plone/api/tests/test_group.py\n+++ b/src/plone/api/tests/test_group.py\n@@ -775,3 +775,32 @@ def test_revoke_roles_in_context(self):\n ROLES,\n set(api.group.get_roles(group=group, obj=document)),\n )\n+\n+ def test_local_roles_no_inheritance(self):\n+ """Test possibility to disregard roles\n+ for inherited groups."""\n+ api.group.create(groupname=\'ploneboat\')\n+ portal = api.portal.get()\n+ folder = api.content.create(\n+ container=portal,\n+ type=\'Folder\',\n+ id=\'folder_one\',\n+ title=\'Folder One\',\n+ )\n+ document = api.content.create(\n+ container=folder,\n+ type=\'Document\',\n+ id=\'document_one\',\n+ title=\'Document One\',\n+ )\n+ api.group.grant_roles(\n+ groupname=\'ploneboat\',\n+ roles=[\'Reviewer\', \'Editor\'],\n+ obj=document,\n+ )\n+ document.manage_setLocalRoles(\n+ \'AuthenticatedUsers\', (\'Reader\',))\n+ self.assertNotIn(\n+ \'Reader\',\n+ api.group.get_roles(groupname=\'ploneboat\', inherit=False, obj=document)\n+ )\n' | ||
|
||
Repository: plone.api | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-10-16T13:16:26+02:00 | ||
Author: tschorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.api/commit/488c2fc2de833dc3c52b610a20430023f2645738 | ||
|
||
update changelog | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
|
||
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 61f18de..46506aa 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,7 +14,8 @@ New features:\n \n Bug fixes:\n \n-- *add item here*\n+- Show only local roles when inherit=False.\n+ [tschorr]\n \n \n 1.9.0 (2018-09-27)\n@@ -34,7 +35,7 @@ Bug fixes:\n - Removed allow-hosts from base.cfg, so we can use the new pypi warehouse.\n Refs https://github.com/plone/plone.api/issues/403\n [jaroel]\n- \n+\n - fix typos in doc strings\n [tkimnguyen]\n \n' | ||
|
||
Repository: plone.api | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-10-16T13:26:40+02:00 | ||
Author: tschorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.api/commit/ab6e9bdfc3e99aef0262b165c65b9973fa7dce3c | ||
|
||
PEP8 | ||
https://github.com/plone/plone.namedfile/issues/68 | ||
|
||
Files changed: | ||
M src/plone/api/tests/test_group.py | ||
M plone/namedfile/file.py | ||
|
||
b"diff --git a/src/plone/api/tests/test_group.py b/src/plone/api/tests/test_group.py\nindex e2dc59d..94574f3 100644\n--- a/src/plone/api/tests/test_group.py\n+++ b/src/plone/api/tests/test_group.py\n@@ -802,5 +802,6 @@ def test_local_roles_no_inheritance(self):\n 'AuthenticatedUsers', ('Reader',))\n self.assertNotIn(\n 'Reader',\n- api.group.get_roles(groupname='ploneboat', inherit=False, obj=document)\n+ api.group.get_roles(\n+ groupname='ploneboat', inherit=False, obj=document),\n )\n" | ||
b"diff --git a/plone/namedfile/file.py b/plone/namedfile/file.py\nindex 8a98e44..1f63219 100644\n--- a/plone/namedfile/file.py\n+++ b/plone/namedfile/file.py\n@@ -387,8 +387,15 @@ def __init__(self, data='', contentType='', filename=None):\n 'Exif Data: %s', exif_data)\n orientation = exif_data['0th'].get(piexif.ImageIFD.Orientation, 1)\n if 1 < orientation <= 8:\n- self.data, self._width, self._height, self.exif = rotate_image(\n- self.data)\n+ try:\n+ self.data, self._width, self._height, self.exif = \\\n+ rotate_image(self.data)\n+ except KeyboardInterrupt:\n+ raise\n+ except Exception:\n+ log.warning(\n+ 'Error rotating image %s based on exif data.',\n+ filename, exc_info=1)\n else:\n self.exif = exif_data\n \n" | ||
|
||
Repository: plone.api | ||
Repository: plone.namedfile | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-10-16T14:10:51+02:00 | ||
Author: tschorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.api/commit/96e4e48494d4efd684f3033609bfd75f30962b0d | ||
Branch: refs/heads/4.2.x | ||
Date: 2018-11-05T22:08:30+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.namedfile/commit/2f553c514f0f3cd8a1b759a100665904c49e0399 | ||
|
||
PEP8 | ||
Forgot to commit news file | ||
|
||
Files changed: | ||
M src/plone/api/tests/test_group.py | ||
A news/68.bugfix | ||
|
||
b"diff --git a/src/plone/api/tests/test_group.py b/src/plone/api/tests/test_group.py\nindex 94574f3..907973e 100644\n--- a/src/plone/api/tests/test_group.py\n+++ b/src/plone/api/tests/test_group.py\n@@ -798,10 +798,8 @@ def test_local_roles_no_inheritance(self):\n roles=['Reviewer', 'Editor'],\n obj=document,\n )\n- document.manage_setLocalRoles(\n- 'AuthenticatedUsers', ('Reader',))\n+ document.manage_setLocalRoles('AuthenticatedUsers', ('Reader',))\n self.assertNotIn(\n 'Reader',\n- api.group.get_roles(\n- groupname='ploneboat', inherit=False, obj=document),\n+ api.group.get_roles(groupname='ploneboat', inherit=False, obj=document), # noqa: E501\n )\n" | ||
b'diff --git a/news/68.bugfix b/news/68.bugfix\nnew file mode 100644\nindex 0000000..9060b3f\n--- /dev/null\n+++ b/news/68.bugfix\n@@ -0,0 +1 @@\n+Do not fail image upload when Exif data is bad. [maurits]\n' | ||
|
||
Repository: plone.api | ||
Repository: plone.namedfile | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2018-11-05T07:00:19+01:00 | ||
Author: Thomas Schorr (tschorr) <t_schorr@gmx.de> | ||
Commit: https://github.com/plone/plone.api/commit/d2bf66834206cdc58162046b16d1b8d739d6db45 | ||
Branch: refs/heads/4.2.x | ||
Date: 2018-11-09T00:32:47+01:00 | ||
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> | ||
Commit: https://github.com/plone/plone.namedfile/commit/d7163c41659174858b143d3c36e928bef0a1a5ec | ||
|
||
Merge pull request #416 from plone/show_local_roles_only | ||
Merge pull request #70 from plone/issue-68-branch42 | ||
|
||
Show only local roles when inherit=False | ||
Do not fail image upload when Exif data is bad. [4.2] | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M src/plone/api/group.py | ||
M src/plone/api/tests/test_group.py | ||
A news/68.bugfix | ||
M plone/namedfile/file.py | ||
|
||
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 61f18de..46506aa 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,7 +14,8 @@ New features:\n \n Bug fixes:\n \n-- *add item here*\n+- Show only local roles when inherit=False.\n+ [tschorr]\n \n \n 1.9.0 (2018-09-27)\n@@ -34,7 +35,7 @@ Bug fixes:\n - Removed allow-hosts from base.cfg, so we can use the new pypi warehouse.\n Refs https://github.com/plone/plone.api/issues/403\n [jaroel]\n- \n+\n - fix typos in doc strings\n [tkimnguyen]\n \ndiff --git a/src/plone/api/group.py b/src/plone/api/group.py\nindex a7b4b43..be8d50f 100644\n--- a/src/plone/api/group.py\n+++ b/src/plone/api/group.py\n@@ -216,6 +216,8 @@ def get_roles(groupname=None, group=None, obj=None, inherit=True):\n :type group: GroupData object\n :param obj: If obj is set then return local roles on this context.\n :type obj: content object\n+ :param inherit: Show only local roles if False\n+ :type inherit: boolean\n :raises:\n ValueError\n :Example: :ref:`group_get_roles_example`\n@@ -239,17 +241,12 @@ def get_roles(groupname=None, group=None, obj=None, inherit=True):\n else:\n # get only the local roles on a object\n # same as above we use the PloneUser version of getRolesInContext.\n- # Include roles inherited from being the member of a group\n- # and from adapters granting local roles\n- plone_user = super(group.__class__, group)\n- principal_ids = list(plone_user.getGroups())\n- principal_ids.insert(0, plone_user.getId())\n+ # Include roles from adapters granting local roles\n roles = set([])\n pas = portal.get_tool(\'acl_users\')\n for _, lrmanager in pas.plugins.listPlugins(ILocalRolesPlugin):\n for adapter in lrmanager._getAdapters(obj):\n- for principal_id in principal_ids:\n- roles.update(adapter.getRoles(principal_id))\n+ roles.update(adapter.getRoles(group_id))\n return list(roles)\n \n \ndiff --git a/src/plone/api/tests/test_group.py b/src/plone/api/tests/test_group.py\nindex 8c96ec9..907973e 100644\n--- a/src/plone/api/tests/test_group.py\n+++ b/src/plone/api/tests/test_group.py\n@@ -775,3 +775,31 @@ def test_revoke_roles_in_context(self):\n ROLES,\n set(api.group.get_roles(group=group, obj=document)),\n )\n+\n+ def test_local_roles_no_inheritance(self):\n+ """Test possibility to disregard roles\n+ for inherited groups."""\n+ api.group.create(groupname=\'ploneboat\')\n+ portal = api.portal.get()\n+ folder = api.content.create(\n+ container=portal,\n+ type=\'Folder\',\n+ id=\'folder_one\',\n+ title=\'Folder One\',\n+ )\n+ document = api.content.create(\n+ container=folder,\n+ type=\'Document\',\n+ id=\'document_one\',\n+ title=\'Document One\',\n+ )\n+ api.group.grant_roles(\n+ groupname=\'ploneboat\',\n+ roles=[\'Reviewer\', \'Editor\'],\n+ obj=document,\n+ )\n+ document.manage_setLocalRoles(\'AuthenticatedUsers\', (\'Reader\',))\n+ self.assertNotIn(\n+ \'Reader\',\n+ api.group.get_roles(groupname=\'ploneboat\', inherit=False, obj=document), # noqa: E501\n+ )\n' | ||
b"diff --git a/news/68.bugfix b/news/68.bugfix\nnew file mode 100644\nindex 0000000..9060b3f\n--- /dev/null\n+++ b/news/68.bugfix\n@@ -0,0 +1 @@\n+Do not fail image upload when Exif data is bad. [maurits]\ndiff --git a/plone/namedfile/file.py b/plone/namedfile/file.py\nindex 8a98e44..1f63219 100644\n--- a/plone/namedfile/file.py\n+++ b/plone/namedfile/file.py\n@@ -387,8 +387,15 @@ def __init__(self, data='', contentType='', filename=None):\n 'Exif Data: %s', exif_data)\n orientation = exif_data['0th'].get(piexif.ImageIFD.Orientation, 1)\n if 1 < orientation <= 8:\n- self.data, self._width, self._height, self.exif = rotate_image(\n- self.data)\n+ try:\n+ self.data, self._width, self._height, self.exif = \\\n+ rotate_image(self.data)\n+ except KeyboardInterrupt:\n+ raise\n+ except Exception:\n+ log.warning(\n+ 'Error rotating image %s based on exif data.',\n+ filename, exc_info=1)\n else:\n self.exif = exif_data\n \n" | ||
|