Skip to content

Commit

Permalink
[fc] Repository: plone.app.users
Browse files Browse the repository at this point in the history
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
jensens committed Jun 7, 2024
1 parent 7e35d11 commit 3c7e6c9
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
Repository: plone.app.content
Repository: plone.app.users


Branch: refs/heads/master
Date: 2024-06-06T23:32:52+02:00
Date: 2024-06-06T17:48:29+02:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: https://github.com/plone/plone.app.content/commit/87bd1226681f18faa2df28e6a897f64b4a53fda2
Commit: https://github.com/plone/plone.app.users/commit/cd12376ff835e6fea02e6b36b4503eafe1750c4c

No longer check visible_ids on the 'select default page' form.
Fix error on personal-information page when you leave an existing portrait unchanged.

Usage of ``visible_ids`` was largely removed in Plone 5.0 already, and you cannot change the setting on the portal or the member.
This was using the deprecated ``portal_properties`` tool.
See also https://github.com/plone/plone.app.contenttypes/pull/693
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/content/browser/templates/select_default_page.pt
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 00000000..07313dda\n--- /dev/null\n+++ b/news/125.bugfix\n@@ -0,0 +1,4 @@\n+No longer check ``visible_ids`` on the \'select default page\' form.\n+Usage of ``visible_ids`` was largely removed in Plone 5.0 already, and you cannot change the setting on the portal or the member.\n+This was using the deprecated ``portal_properties`` tool.\n+[maurits]\ndiff --git a/plone/app/content/browser/templates/select_default_page.pt b/plone/app/content/browser/templates/select_default_page.pt\nindex 302fbd13..d7b33794 100644\n--- a/plone/app/content/browser/templates/select_default_page.pt\n+++ b/plone/app/content/browser/templates/select_default_page.pt\n@@ -46,9 +46,6 @@\n ">\n <tal:hasitems define="\n n_items python:len(items);\n- member portal_state/member;\n- portal_visible_ids context/portal_properties/site_properties/visible_ids|nothing;\n- member_visible_ids python:member.getProperty(\'visible_ids\', context.portal_memberdata.getProperty(\'visible_ids\'));\n "\n condition="items"\n >\n@@ -56,7 +53,6 @@\n <tal:item repeat="item items">\n <dt tal:define="\n normalized_type python:plone_view.normalizeString(item.portal_type);\n- item_id python:\'(%s)\' % item.getId if (portal_visible_ids and member_visible_ids) else \'\';\n ">\n <input name="objectId"\n type="radio"\n@@ -67,7 +63,7 @@\n checked python: (n_items==1 or item.getId==cur_page) and \'checked\' or None;\n "\n />\n- <label tal:content="string:${item/pretty_title_or_id} $item_id"\n+ <label tal:content="string:${item/pretty_title_or_id}"\n tal:attributes="\n for item/getId;\n class string:contenttype-${normalized_type};\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.content
Repository: plone.app.users


Branch: refs/heads/master
Date: 2024-06-07T05:47:09-04:00
Date: 2024-06-07T10:00:19-04:00
Author: Jens W. Klein (jensens) <[email protected]>
Commit: https://github.com/plone/plone.app.content/commit/a7a5cdd8f6b053dadda1da0b23250785e5db3116
Commit: https://github.com/plone/plone.app.users/commit/2c8f9d018056828d61a7f8b3fd0c83c8dad980ae

Merge pull request #283 from plone/remove-portal-properties-tool
Merge pull request #129 from plone/maurits-fix-portrait-not-changed

No longer check visible_ids on the 'select default page' form.
Fix error on personal-information when leaving existing portrait unchanged

Files changed:
A news/125.bugfix
M plone/app/content/browser/templates/select_default_page.pt
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 00000000..07313dda\n--- /dev/null\n+++ b/news/125.bugfix\n@@ -0,0 +1,4 @@\n+No longer check ``visible_ids`` on the \'select default page\' form.\n+Usage of ``visible_ids`` was largely removed in Plone 5.0 already, and you cannot change the setting on the portal or the member.\n+This was using the deprecated ``portal_properties`` tool.\n+[maurits]\ndiff --git a/plone/app/content/browser/templates/select_default_page.pt b/plone/app/content/browser/templates/select_default_page.pt\nindex 302fbd13..d7b33794 100644\n--- a/plone/app/content/browser/templates/select_default_page.pt\n+++ b/plone/app/content/browser/templates/select_default_page.pt\n@@ -46,9 +46,6 @@\n ">\n <tal:hasitems define="\n n_items python:len(items);\n- member portal_state/member;\n- portal_visible_ids context/portal_properties/site_properties/visible_ids|nothing;\n- member_visible_ids python:member.getProperty(\'visible_ids\', context.portal_memberdata.getProperty(\'visible_ids\'));\n "\n condition="items"\n >\n@@ -56,7 +53,6 @@\n <tal:item repeat="item items">\n <dt tal:define="\n normalized_type python:plone_view.normalizeString(item.portal_type);\n- item_id python:\'(%s)\' % item.getId if (portal_visible_ids and member_visible_ids) else \'\';\n ">\n <input name="objectId"\n type="radio"\n@@ -67,7 +63,7 @@\n checked python: (n_items==1 or item.getId==cur_page) and \'checked\' or None;\n "\n />\n- <label tal:content="string:${item/pretty_title_or_id} $item_id"\n+ <label tal:content="string:${item/pretty_title_or_id}"\n tal:attributes="\n for item/getId;\n class string:contenttype-${normalized_type};\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'

0 comments on commit 3c7e6c9

Please sign in to comment.