-
-
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/master Date: 2024-06-06T17:48:29+02:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/plone.app.users@cd12376 Fix error on personal-information page when you leave an existing portrait unchanged. The previous release added validation, but this caused a regression. Fixes plone/plone.app.users#126 Files changed: A news/126.bugfix M plone/app/users/browser/account.py Repository: plone.app.users Branch: refs/heads/master Date: 2024-06-07T10:00:19-04:00 Author: Jens W. Klein (jensens) <[email protected]> Commit: plone/plone.app.users@2c8f9d0 Merge pull request #129 from plone/maurits-fix-portrait-not-changed Fix error on personal-information when leaving existing portrait unchanged Files changed: A news/126.bugfix M plone/app/users/browser/account.py
- Loading branch information
Showing
1 changed file
with
17 additions
and
22 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,42 +1,37 @@ | ||
Repository: plone.app.contenttypes | ||
Repository: plone.app.users | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-06-06T23:16:49+02:00 | ||
Date: 2024-06-06T17:48:29+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.contenttypes/commit/11488f50797c51ca810e474cc65f4789b2ef296b | ||
Commit: https://github.com/plone/plone.app.users/commit/cd12376ff835e6fea02e6b36b4503eafe1750c4c | ||
|
||
No longer set portal_properties.site_properties.visible_ids on site creation. | ||
Fix error on personal-information page when you leave an existing portrait unchanged. | ||
|
||
The ``portal_properties`` tools is deprecated, ``visible_ids`` was not set as real property, and usage of ``visible_ids`` was largely removed in Plone 5.0 already. | ||
You already can no longer set ``visible ids`` in the Editing control panel, nor in the member preferences. | ||
The only remaining use for ``visible_ids``, if set to true, was to show the page ids on the 'select default page' form. | ||
The previous release added validation, but this caused a regression. | ||
Fixes https://github.com/plone/plone.app.users/issues/126 | ||
|
||
Files changed: | ||
A news/125.bugfix | ||
M plone/app/contenttypes/browser/templates/full_view_item.pt | ||
M plone/app/contenttypes/setuphandlers.py | ||
M setup.py | ||
A news/126.bugfix | ||
M plone/app/users/browser/account.py | ||
|
||
b'diff --git a/news/125.bugfix b/news/125.bugfix\nnew file mode 100644\nindex 000000000..22b6b61c0\n--- /dev/null\n+++ b/news/125.bugfix\n@@ -0,0 +1,5 @@\n+No longer set ``portal_properties.site_properties.visible_ids`` on site creation.\n+The ``portal_properties`` tools is deprecated, ``visible_ids`` was not set as real property, and usage of ``visible_ids`` was largely removed in Plone 5.0 already.\n+You already can no longer set ``visible ids`` in the Editing control panel, nor in the member preferences.\n+The only remaining use for ``visible_ids``, if set to true, was to show the page ids on the \'select default page\' form.\n+[maurits]\ndiff --git a/plone/app/contenttypes/browser/templates/full_view_item.pt b/plone/app/contenttypes/browser/templates/full_view_item.pt\nindex 208207d2f..e17e57900 100644\n--- a/plone/app/contenttypes/browser/templates/full_view_item.pt\n+++ b/plone/app/contenttypes/browser/templates/full_view_item.pt\n@@ -57,7 +57,6 @@\n dummy python: plone_layout.mark_view(view);\n portal_url portal_state/portal_url;\n checkPermission nocall: context/portal_membership/checkPermission;\n- site_properties context/portal_properties/site_properties;\n ">\n \n <div metal:use-macro="item_macro">\ndiff --git a/plone/app/contenttypes/setuphandlers.py b/plone/app/contenttypes/setuphandlers.py\nindex f1b881450..d312d862f 100644\n--- a/plone/app/contenttypes/setuphandlers.py\n+++ b/plone/app/contenttypes/setuphandlers.py\n@@ -9,7 +9,6 @@\n from plone.base.utils import unrestricted_construct_instance\n from plone.dexterity.fti import IDexterityFTI\n from plone.dexterity.utils import createContent\n-from plone.i18n.normalizer.interfaces import IURLNormalizer\n from plone.portlets.interfaces import ILocalPortletAssignmentManager\n from plone.portlets.interfaces import IPortletManager\n from plone.registry.interfaces import IRegistry\n@@ -131,25 +130,6 @@ def _setup_calendar(portal, locale):\n portal_calendar.firstweekday = first\n \n \n-def _setup_visible_ids(portal, target_language, locale):\n- portal_properties = getToolByName(portal, "portal_properties")\n- site_properties = portal_properties.site_properties\n-\n- # See if we have a URL normalizer\n- normalizer = queryUtility(IURLNormalizer, name=target_language)\n- if normalizer is None:\n- normalizer = queryUtility(IURLNormalizer)\n-\n- # If we get a script other than Latn we enable visible_ids\n- if locale.id.script is not None:\n- if locale.id.script.lower() != "latn":\n- site_properties.visible_ids = True\n-\n- # If we have a normalizer it is safe to disable the visible ids\n- if normalizer is not None:\n- site_properties.visible_ids = False\n-\n-\n def _setup_constrains(container, allowed_types):\n behavior = ISelectableConstrainTypes(container)\n behavior.setConstrainTypesMode(constrains.ENABLED)\n@@ -361,7 +341,6 @@ def setup_various(context):\n portal = getSite()\n target_language, is_combined_language, locale = _get_locales_info(portal)\n _setup_calendar(portal, locale)\n- _setup_visible_ids(portal, target_language, locale)\n \n # install explicitly the plone.app.event\n if HAS_EVENT:\ndiff --git a/setup.py b/setup.py\nindex 510d4eca1..e0953ea72 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -71,7 +71,6 @@ def read(*rnames):\n "plone.autoform",\n "plone.event",\n "plone.folder",\n- "plone.i18n",\n "plone.indexer",\n "plone.memoize",\n "plone.portlets",\n' | ||
b'diff --git a/news/126.bugfix b/news/126.bugfix\nnew file mode 100644\nindex 00000000..aeba0c57\n--- /dev/null\n+++ b/news/126.bugfix\n@@ -0,0 +1,3 @@\n+Fix error on personal-information page when you leave an existing portrait unchanged.\n+The previous release added validation, but this caused a regression.\n+[maurits]\ndiff --git a/plone/app/users/browser/account.py b/plone/app/users/browser/account.py\nindex 720e53f9..b9aa9fde 100644\n--- a/plone/app/users/browser/account.py\n+++ b/plone/app/users/browser/account.py\n@@ -21,6 +21,7 @@\n from Products.statusmessages.interfaces import IStatusMessage\n from z3c.form import button\n from z3c.form import form\n+from z3c.form.interfaces import NOT_CHANGED\n from zope import schema\n from zope.cachedescriptors.property import Lazy as lazy_property\n from zope.component import getMultiAdapter\n@@ -272,8 +273,12 @@ def validate_portrait(self, action, data):\n SVG files are not yet supported.\n """\n error_keys = [error.field.getName() for error in action.form.widgets.errors]\n- if "portrait" not in error_keys and data["portrait"] is not None:\n- portrait = data["portrait"].open()\n+ if "portrait" in error_keys:\n+ return\n+ portrait_file = data["portrait"]\n+ if portrait_file is None or portrait_file is NOT_CHANGED:\n+ return\n+ with portrait_file.open() as portrait:\n try:\n Image.open(portrait)\n except UnidentifiedImageError:\n' | ||
|
||
Repository: plone.app.contenttypes | ||
Repository: plone.app.users | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-06-07T08:42:48-04:00 | ||
Date: 2024-06-07T10:00:19-04:00 | ||
Author: Jens W. Klein (jensens) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.contenttypes/commit/0d68e5528054e9131976f45f29442a819fa39364 | ||
Commit: https://github.com/plone/plone.app.users/commit/2c8f9d018056828d61a7f8b3fd0c83c8dad980ae | ||
|
||
Merge pull request #693 from plone/remove-portal-properties-tool | ||
Merge pull request #129 from plone/maurits-fix-portrait-not-changed | ||
|
||
No longer set portal_properties.site_properties.visible_ids on site creation | ||
Fix error on personal-information when leaving existing portrait unchanged | ||
|
||
Files changed: | ||
A news/125.bugfix | ||
M plone/app/contenttypes/browser/templates/full_view_item.pt | ||
M plone/app/contenttypes/setuphandlers.py | ||
M setup.py | ||
A news/126.bugfix | ||
M plone/app/users/browser/account.py | ||
|
||
b'diff --git a/news/125.bugfix b/news/125.bugfix\nnew file mode 100644\nindex 000000000..22b6b61c0\n--- /dev/null\n+++ b/news/125.bugfix\n@@ -0,0 +1,5 @@\n+No longer set ``portal_properties.site_properties.visible_ids`` on site creation.\n+The ``portal_properties`` tools is deprecated, ``visible_ids`` was not set as real property, and usage of ``visible_ids`` was largely removed in Plone 5.0 already.\n+You already can no longer set ``visible ids`` in the Editing control panel, nor in the member preferences.\n+The only remaining use for ``visible_ids``, if set to true, was to show the page ids on the \'select default page\' form.\n+[maurits]\ndiff --git a/plone/app/contenttypes/browser/templates/full_view_item.pt b/plone/app/contenttypes/browser/templates/full_view_item.pt\nindex 208207d2f..e17e57900 100644\n--- a/plone/app/contenttypes/browser/templates/full_view_item.pt\n+++ b/plone/app/contenttypes/browser/templates/full_view_item.pt\n@@ -57,7 +57,6 @@\n dummy python: plone_layout.mark_view(view);\n portal_url portal_state/portal_url;\n checkPermission nocall: context/portal_membership/checkPermission;\n- site_properties context/portal_properties/site_properties;\n ">\n \n <div metal:use-macro="item_macro">\ndiff --git a/plone/app/contenttypes/setuphandlers.py b/plone/app/contenttypes/setuphandlers.py\nindex f1b881450..d312d862f 100644\n--- a/plone/app/contenttypes/setuphandlers.py\n+++ b/plone/app/contenttypes/setuphandlers.py\n@@ -9,7 +9,6 @@\n from plone.base.utils import unrestricted_construct_instance\n from plone.dexterity.fti import IDexterityFTI\n from plone.dexterity.utils import createContent\n-from plone.i18n.normalizer.interfaces import IURLNormalizer\n from plone.portlets.interfaces import ILocalPortletAssignmentManager\n from plone.portlets.interfaces import IPortletManager\n from plone.registry.interfaces import IRegistry\n@@ -131,25 +130,6 @@ def _setup_calendar(portal, locale):\n portal_calendar.firstweekday = first\n \n \n-def _setup_visible_ids(portal, target_language, locale):\n- portal_properties = getToolByName(portal, "portal_properties")\n- site_properties = portal_properties.site_properties\n-\n- # See if we have a URL normalizer\n- normalizer = queryUtility(IURLNormalizer, name=target_language)\n- if normalizer is None:\n- normalizer = queryUtility(IURLNormalizer)\n-\n- # If we get a script other than Latn we enable visible_ids\n- if locale.id.script is not None:\n- if locale.id.script.lower() != "latn":\n- site_properties.visible_ids = True\n-\n- # If we have a normalizer it is safe to disable the visible ids\n- if normalizer is not None:\n- site_properties.visible_ids = False\n-\n-\n def _setup_constrains(container, allowed_types):\n behavior = ISelectableConstrainTypes(container)\n behavior.setConstrainTypesMode(constrains.ENABLED)\n@@ -361,7 +341,6 @@ def setup_various(context):\n portal = getSite()\n target_language, is_combined_language, locale = _get_locales_info(portal)\n _setup_calendar(portal, locale)\n- _setup_visible_ids(portal, target_language, locale)\n \n # install explicitly the plone.app.event\n if HAS_EVENT:\ndiff --git a/setup.py b/setup.py\nindex 510d4eca1..e0953ea72 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -71,7 +71,6 @@ def read(*rnames):\n "plone.autoform",\n "plone.event",\n "plone.folder",\n- "plone.i18n",\n "plone.indexer",\n "plone.memoize",\n "plone.portlets",\n' | ||
b'diff --git a/news/126.bugfix b/news/126.bugfix\nnew file mode 100644\nindex 00000000..aeba0c57\n--- /dev/null\n+++ b/news/126.bugfix\n@@ -0,0 +1,3 @@\n+Fix error on personal-information page when you leave an existing portrait unchanged.\n+The previous release added validation, but this caused a regression.\n+[maurits]\ndiff --git a/plone/app/users/browser/account.py b/plone/app/users/browser/account.py\nindex 720e53f9..b9aa9fde 100644\n--- a/plone/app/users/browser/account.py\n+++ b/plone/app/users/browser/account.py\n@@ -21,6 +21,7 @@\n from Products.statusmessages.interfaces import IStatusMessage\n from z3c.form import button\n from z3c.form import form\n+from z3c.form.interfaces import NOT_CHANGED\n from zope import schema\n from zope.cachedescriptors.property import Lazy as lazy_property\n from zope.component import getMultiAdapter\n@@ -272,8 +273,12 @@ def validate_portrait(self, action, data):\n SVG files are not yet supported.\n """\n error_keys = [error.field.getName() for error in action.form.widgets.errors]\n- if "portrait" not in error_keys and data["portrait"] is not None:\n- portrait = data["portrait"].open()\n+ if "portrait" in error_keys:\n+ return\n+ portrait_file = data["portrait"]\n+ if portrait_file is None or portrait_file is NOT_CHANGED:\n+ return\n+ with portrait_file.open() as portrait:\n try:\n Image.open(portrait)\n except UnidentifiedImageError:\n' | ||
|