Skip to content

Commit

Permalink
[fc] Repository: plone.app.layout
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2023-12-05T10:07:00+01:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: plone/plone.app.layout@ebbf718

Fix KeyError `time` when missing workflow variables are added later.

Fixes plone/plone.app.layout#357.

Files changed:
A news/357.bugfix
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/content_history.pt
  • Loading branch information
mauritsvanrees committed Dec 5, 2023
1 parent d483c6f commit b0bb83e
Showing 1 changed file with 11 additions and 40 deletions.
51 changes: 11 additions & 40 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,19 @@
Repository: Products.CMFPlone
Repository: plone.app.layout


Branch: refs/heads/6.0.x
Date: 2023-12-01T20:09:12+01:00
Author: 1letter (1letter) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/a05b4de80bd4ecb75e86957d31d0e7d6f6b95547
Branch: refs/heads/master
Date: 2023-12-05T10:07:00+01:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: https://github.com/plone/plone.app.layout/commit/ebbf718c2852e7eb479ba5879ee44fe6c4714146

Update wording
Fix KeyError `time` when missing workflow variables are added later.

Files changed:
M Products/CMFPlone/browser/templates/plone-overview.pt

b'diff --git a/Products/CMFPlone/browser/templates/plone-overview.pt b/Products/CMFPlone/browser/templates/plone-overview.pt\nindex d84963c36b..035f0b4856 100644\n--- a/Products/CMFPlone/browser/templates/plone-overview.pt\n+++ b/Products/CMFPlone/browser/templates/plone-overview.pt\n@@ -92,7 +92,7 @@\n i18n:translate=""\n tal:condition="view/has_volto"\n href="${action}?site_id=Plone${site_number}&amp;classic=1"\n- >Create Classic Plone site</a>\n+ >Create Classic UI Plone site</a>\n <a class="btn btn-secondary"\n i18n:translate=""\n href="${action}?site_id=Plone${site_number}&amp;advanced=1"\n@@ -106,7 +106,7 @@\n an additional frontend service to use this setup.\n </p>\n <p i18n:translate="help_create_plone_site_buttons_2">\n- The \'Create Classic Plone site\' button creates a Plone site configured\n+ The \'Create Classic UI Plone site\' button creates a Plone site configured\n for HTML based output, as was already supported by previous Plone versions.\n Please consult our\n <a href="https://6.docs.plone.org/" title="Plone 6 developer documentation"\n'

Repository: Products.CMFPlone


Branch: refs/heads/6.0.x
Date: 2023-12-01T20:09:19+01:00
Author: 1letter (1letter) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/6eb7aa954e2df1f6e71a1cf830d0d46dc575560e

add News

Files changed:
A news/3873.bugfix

b'diff --git a/news/3873.bugfix b/news/3873.bugfix\nnew file mode 100644\nindex 0000000000..e201ecd08b\n--- /dev/null\n+++ b/news/3873.bugfix\n@@ -0,0 +1 @@\n+Corrected the name in a button and help text to "Classic UI" when creating a Plone site. @1letter\n'

Repository: Products.CMFPlone


Branch: refs/heads/6.0.x
Date: 2023-12-02T03:08:05-05:00
Author: Steve Piercy (stevepiercy) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/ba486820dbbddd35828c453a56600afa2e3d505b

Merge pull request #3884 from plone/1letter-fix#3873-6.0.x

Backport Fix #3873 to 6.0.x
Fixes https://github.com/plone/plone.app.layout/issues/357.

Files changed:
A news/3873.bugfix
M Products/CMFPlone/browser/templates/plone-overview.pt
A news/357.bugfix
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/content_history.pt

b'diff --git a/Products/CMFPlone/browser/templates/plone-overview.pt b/Products/CMFPlone/browser/templates/plone-overview.pt\nindex d84963c36b..035f0b4856 100644\n--- a/Products/CMFPlone/browser/templates/plone-overview.pt\n+++ b/Products/CMFPlone/browser/templates/plone-overview.pt\n@@ -92,7 +92,7 @@\n i18n:translate=""\n tal:condition="view/has_volto"\n href="${action}?site_id=Plone${site_number}&amp;classic=1"\n- >Create Classic Plone site</a>\n+ >Create Classic UI Plone site</a>\n <a class="btn btn-secondary"\n i18n:translate=""\n href="${action}?site_id=Plone${site_number}&amp;advanced=1"\n@@ -106,7 +106,7 @@\n an additional frontend service to use this setup.\n </p>\n <p i18n:translate="help_create_plone_site_buttons_2">\n- The \'Create Classic Plone site\' button creates a Plone site configured\n+ The \'Create Classic UI Plone site\' button creates a Plone site configured\n for HTML based output, as was already supported by previous Plone versions.\n Please consult our\n <a href="https://6.docs.plone.org/" title="Plone 6 developer documentation"\ndiff --git a/news/3873.bugfix b/news/3873.bugfix\nnew file mode 100644\nindex 0000000000..e201ecd08b\n--- /dev/null\n+++ b/news/3873.bugfix\n@@ -0,0 +1 @@\n+Corrected the name in a button and help text to "Classic UI" when creating a Plone site. @1letter\n'
b'diff --git a/news/357.bugfix b/news/357.bugfix\nnew file mode 100644\nindex 00000000..47e82fd2\n--- /dev/null\n+++ b/news/357.bugfix\n@@ -0,0 +1,3 @@\n+Fix KeyError `time` when missing workflow variables are added later.\n+Fixes `issue 357 <https://github.com/plone/plone.app.layout/issues/357>`_.\n+[maurits]\ndiff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py\nindex 28633600..efc8d4e4 100644\n--- a/plone/app/layout/viewlets/content.py\n+++ b/plone/app/layout/viewlets/content.py\n@@ -383,30 +383,43 @@ def workflowHistory(self, complete=True):\n review_history = []\n \n try:\n- # get total history\n+ # Get total history.\n+ # Note: expected variables like \'action\' may not exist:\n+ # the workflow may have started out without variables.\n review_history = workflow.getInfoFor(context, "review_history")\n \n if not complete:\n # filter out automatic transitions.\n- review_history = [r for r in review_history if r["action"]]\n+ review_history = [r for r in review_history if r.get("action")]\n else:\n review_history = list(review_history)\n \n portal_type = context.portal_type\n anon = _("label_anonymous_user", default="Anonymous User")\n-\n for r in review_history:\n r["type"] = "workflow"\n- r["transition_title"] = workflow.getTitleForTransitionOnType(\n- r["action"], portal_type\n- ) or _("Create")\n+\n+ # Get transition title.\n+ transition_title = ""\n+ action = r.get("action")\n+ if action:\n+ transition_title = workflow.getTitleForTransitionOnType(\n+ action, portal_type\n+ )\n+ if not transition_title:\n+ transition_title = _("Create")\n+ r["transition_title"] = transition_title\n+\n+ # Get state title.\n r["state_title"] = workflow.getTitleForStateOnType(\n- r["review_state"], portal_type\n+ r.get("review_state", ""), portal_type\n )\n- actorid = r["actor"]\n+\n+ # Get actor.\n+ actorid = r.get("actor")\n r["actorid"] = actorid\n if actorid is None:\n- # action performed by an anonymous user\n+ # action performed by an anonymous user, or unknown\n r["actor"] = {"username": anon, "fullname": anon}\n r["actor_home"] = ""\n else:\n@@ -509,7 +522,7 @@ def fullHistory(self):\n history = self.workflowHistory() + self.revisionHistory()\n if len(history) == 0:\n return None\n- history.sort(key=lambda x: x["time"], reverse=True)\n+ history.sort(key=lambda x: x.get("time", 0.0), reverse=True)\n return history\n \n def toLocalizedTime(self, time, long_format=None, time_only=None):\ndiff --git a/plone/app/layout/viewlets/content_history.pt b/plone/app/layout/viewlets/content_history.pt\nindex 831a9a90..71b4b735 100644\n--- a/plone/app/layout/viewlets/content_history.pt\n+++ b/plone/app/layout/viewlets/content_history.pt\n@@ -25,13 +25,13 @@\n <tal:historyitem define="\n rhComments item/comments|nothing;\n actor item/actor;\n- actor_name python:actor and actor.get(\'fullname\',\'username\') or item[\'actorid\'];\n+ actor_name python:actor and actor.get(\'fullname\',\'username\') or item.get(\'actorid\', \'\');\n actor_home item/actor_home;\n action item/transition_title;\n- action_id python:item[\'action\'] or item[\'review_state\'];\n+ action_id python:item.get(\'action\') or item.get(\'review_state\', \'\');\n effective item/effective_date|nothing;\n effectiveDate python:effective and view.toLocalizedTime(item[\'effective_date\'],long_format=True);\n- isVersion python:item[\'type\']==\'versioning\';\n+ isVersion python:item.get(\'type\', \'\')==\'versioning\';\n icons python:context.restrictedTraverse(\'@@iconresolver\');\n ">\n <tr class="historyRecord ${python:\'table-secondary\' if not isVersion else \'\'}">\n@@ -62,7 +62,7 @@\n ></span>\n </tal:actor>\n on\n- <span tal:content="python:view.toLocalizedTime(item[\'time\'],long_format=True)"\n+ <span tal:content="python:view.toLocalizedTime(item.get(\'time\', 0.0),long_format=True)"\n i18n:name="time"\n i18n:translate=""\n ></span>\n'

0 comments on commit b0bb83e

Please sign in to comment.