-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: Products.ATContentTypes
Branch: refs/heads/master Date: 2017-02-05T20:42:33+01:00 Author: Philip Bauer (pbauer) <bauer@starzel.de> Commit: plone/Products.ATContentTypes@ad1c90b Fix doctest The last line results in "KeyError: 0" since data is a list of ZPublisher.HTTPRequest.record instances which calls self.__dict__[key] on __getitem__. Files changed: M CHANGES.rst M Products/ATContentTypes/tool/topic.py Repository: Products.ATContentTypes Branch: refs/heads/master Date: 2017-02-05T20:43:12+01:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/Products.ATContentTypes@5fb7195 Merge pull request #41 from plone/plonezope4 Fix doctest Files changed: M CHANGES.rst M Products/ATContentTypes/tool/topic.py
- Loading branch information
Showing
1 changed file
with
65 additions
and
131 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,172 +1,106 @@ | ||
Repository: plone.app.upgrade | ||
Repository: Products.ATContentTypes | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-02-04T17:50:37+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/b2618eec0af3b32133d216397c86e9cd2fccbfc0 | ||
Date: 2017-02-05T20:42:33+01:00 | ||
Author: Philip Bauer (pbauer) <bauer@starzel.de> | ||
Commit: https://github.com/plone/Products.ATContentTypes/commit/ad1c90b036fb4559f48e9eed6d956db2d8107978 | ||
|
||
Remove displayContentsTab from action expressions in 5.1. | ||
Fix doctest | ||
|
||
Fixes https://github.com/plone/Products.CMFPlone/issues/1935. | ||
The last line results in "KeyError: 0" since data is a list of ZPublisher.HTTPRequest.record instances which calls self.__dict__[key] on __getitem__. | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/app/upgrade/v51/betas.py | ||
M plone/app/upgrade/v51/configure.zcml | ||
M Products/ATContentTypes/tool/topic.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index b8d9491..748090a 100644 | ||
index c7e15c2..89c97ff 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -47,6 +47,10 @@ New features: | ||
@@ -14,7 +14,8 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
+- Remove displayContentsTab from action expressions in 5.1. | ||
+ Fixes https://github.com/plone/Products.CMFPlone/issues/1935. | ||
+ [maurits] | ||
+ | ||
- Fix move_pw_reset_tool upgrade step | ||
[agitator] | ||
-- Fix tests on Zope 4. [davisagli] | ||
+- Fix tests on Zope 4. | ||
+ [davisagli, pbauer, mauritsvanrees] | ||
|
||
diff --git a/plone/app/upgrade/v51/betas.py b/plone/app/upgrade/v51/betas.py | ||
index 6a7b339..a81f078 100644 | ||
--- a/plone/app/upgrade/v51/betas.py | ||
+++ b/plone/app/upgrade/v51/betas.py | ||
@@ -89,3 +89,31 @@ def move_pw_reset_tool(context): | ||
pw_reset_tool._timedelta = int(old_days_timeout) | ||
if old_user_check is not _marker: | ||
pw_reset_tool._user_check = bool(old_user_check) | ||
+ | ||
+ | ||
+def remove_displayContentsTab_from_action_expressions(context): | ||
+ """Remove the displayContentsTab script from action expressions. | ||
+ | ||
+ This script was removed, but it can still be in actions, | ||
+ at least in portal_actions/object/folderContents, | ||
+ where it makes the homepage fail to load. | ||
+ """ | ||
+ atool = getToolByName(context, 'portal_actions') | ||
+ actions = atool.listActions() | ||
+ if not actions: | ||
+ return [] | ||
+ script_name = 'displayContentsTab' | ||
+ text = 'object/{}'.format(script_name) | ||
+ for ac in actions: | ||
+ if script_name not in ac.available_expr: | ||
+ continue | ||
+ path = '/'.join(ac.getPhysicalPath()) | ||
+ if ac.available_expr.strip() == text: | ||
+ ac._setPropValue('available_expr', '') | ||
+ logger.info('Removed %s from action at %s', text, path) | ||
+ continue | ||
+ # The script is in the expression, but it is different than what | ||
+ # we expect. We can only warn the user. | ||
+ logger.warn('Action at %s references removed script %s in available. ' | ||
+ 'expression %r. Please change it', | ||
+ path, text, ac.available_expr) | ||
diff --git a/plone/app/upgrade/v51/configure.zcml b/plone/app/upgrade/v51/configure.zcml | ||
index d05981f..9e6227f 100644 | ||
--- a/plone/app/upgrade/v51/configure.zcml | ||
+++ b/plone/app/upgrade/v51/configure.zcml | ||
@@ -87,6 +87,11 @@ was moved from the plone bundle to plone-logged-in in CMPlone 5.1a2. | ||
handler=".betas.move_pw_reset_tool" | ||
/> | ||
|
||
+ <gs:upgradeStep | ||
+ title="Remove displayContentsTab from action expressions" | ||
+ handler=".betas.remove_displayContentsTab_from_action_expressions" | ||
+ /> | ||
+ | ||
</gs:upgradeSteps> | ||
2.3.2 (2017-01-20) | ||
diff --git a/Products/ATContentTypes/tool/topic.py b/Products/ATContentTypes/tool/topic.py | ||
index 721d875..4a0961a 100644 | ||
--- a/Products/ATContentTypes/tool/topic.py | ||
+++ b/Products/ATContentTypes/tool/topic.py | ||
@@ -317,14 +317,14 @@ def manage_saveTopicSetup(self, REQUEST=None): | ||
|
||
</configure> | ||
data = REQUEST.get('index', []) | ||
for index in data: | ||
- enabled = 'enabled' in index | ||
+ enabled = 'enabled' in index.keys() | ||
criteria = index.get('criteria', ()) | ||
self.updateIndex(index['index'], index['friendlyName'], index[ | ||
'description'], enabled, criteria) | ||
|
||
meta = REQUEST.get('metadata', []) | ||
for metadata in meta: | ||
- enabled = 'enabled' in metadata | ||
+ enabled = 'enabled' in metadata.keys() | ||
self.updateMetadata( | ||
metadata['index'], | ||
metadata['friendlyName'], | ||
|
||
|
||
Repository: plone.app.upgrade | ||
Repository: Products.ATContentTypes | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-02-05T18:48:26+01:00 | ||
Date: 2017-02-05T20:43:12+01:00 | ||
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/0ca6736d44bc13a25972499986a2cf0bb439a0ca | ||
Commit: https://github.com/plone/Products.ATContentTypes/commit/5fb71953e842243a470619f0fde00e6782a130c4 | ||
|
||
Merge pull request #102 from plone/remove-displayContentsTab | ||
Merge pull request #41 from plone/plonezope4 | ||
|
||
Remove displayContentsTab from action expressions in 5.1. | ||
Fix doctest | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/app/upgrade/v51/betas.py | ||
M plone/app/upgrade/v51/configure.zcml | ||
M Products/ATContentTypes/tool/topic.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index b8d9491..748090a 100644 | ||
index c7e15c2..89c97ff 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -47,6 +47,10 @@ New features: | ||
@@ -14,7 +14,8 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
+- Remove displayContentsTab from action expressions in 5.1. | ||
+ Fixes https://github.com/plone/Products.CMFPlone/issues/1935. | ||
+ [maurits] | ||
+ | ||
- Fix move_pw_reset_tool upgrade step | ||
[agitator] | ||
-- Fix tests on Zope 4. [davisagli] | ||
+- Fix tests on Zope 4. | ||
+ [davisagli, pbauer, mauritsvanrees] | ||
|
||
|
||
diff --git a/plone/app/upgrade/v51/betas.py b/plone/app/upgrade/v51/betas.py | ||
index 6a7b339..a81f078 100644 | ||
--- a/plone/app/upgrade/v51/betas.py | ||
+++ b/plone/app/upgrade/v51/betas.py | ||
@@ -89,3 +89,31 @@ def move_pw_reset_tool(context): | ||
pw_reset_tool._timedelta = int(old_days_timeout) | ||
if old_user_check is not _marker: | ||
pw_reset_tool._user_check = bool(old_user_check) | ||
+ | ||
+ | ||
+def remove_displayContentsTab_from_action_expressions(context): | ||
+ """Remove the displayContentsTab script from action expressions. | ||
+ | ||
+ This script was removed, but it can still be in actions, | ||
+ at least in portal_actions/object/folderContents, | ||
+ where it makes the homepage fail to load. | ||
+ """ | ||
+ atool = getToolByName(context, 'portal_actions') | ||
+ actions = atool.listActions() | ||
+ if not actions: | ||
+ return [] | ||
+ script_name = 'displayContentsTab' | ||
+ text = 'object/{}'.format(script_name) | ||
+ for ac in actions: | ||
+ if script_name not in ac.available_expr: | ||
+ continue | ||
+ path = '/'.join(ac.getPhysicalPath()) | ||
+ if ac.available_expr.strip() == text: | ||
+ ac._setPropValue('available_expr', '') | ||
+ logger.info('Removed %s from action at %s', text, path) | ||
+ continue | ||
+ # The script is in the expression, but it is different than what | ||
+ # we expect. We can only warn the user. | ||
+ logger.warn('Action at %s references removed script %s in available. ' | ||
+ 'expression %r. Please change it', | ||
+ path, text, ac.available_expr) | ||
diff --git a/plone/app/upgrade/v51/configure.zcml b/plone/app/upgrade/v51/configure.zcml | ||
index d05981f..9e6227f 100644 | ||
--- a/plone/app/upgrade/v51/configure.zcml | ||
+++ b/plone/app/upgrade/v51/configure.zcml | ||
@@ -87,6 +87,11 @@ was moved from the plone bundle to plone-logged-in in CMPlone 5.1a2. | ||
handler=".betas.move_pw_reset_tool" | ||
/> | ||
2.3.2 (2017-01-20) | ||
diff --git a/Products/ATContentTypes/tool/topic.py b/Products/ATContentTypes/tool/topic.py | ||
index 721d875..4a0961a 100644 | ||
--- a/Products/ATContentTypes/tool/topic.py | ||
+++ b/Products/ATContentTypes/tool/topic.py | ||
@@ -317,14 +317,14 @@ def manage_saveTopicSetup(self, REQUEST=None): | ||
|
||
+ <gs:upgradeStep | ||
+ title="Remove displayContentsTab from action expressions" | ||
+ handler=".betas.remove_displayContentsTab_from_action_expressions" | ||
+ /> | ||
+ | ||
</gs:upgradeSteps> | ||
data = REQUEST.get('index', []) | ||
for index in data: | ||
- enabled = 'enabled' in index | ||
+ enabled = 'enabled' in index.keys() | ||
criteria = index.get('criteria', ()) | ||
self.updateIndex(index['index'], index['friendlyName'], index[ | ||
'description'], enabled, criteria) | ||
|
||
</configure> | ||
meta = REQUEST.get('metadata', []) | ||
for metadata in meta: | ||
- enabled = 'enabled' in metadata | ||
+ enabled = 'enabled' in metadata.keys() | ||
self.updateMetadata( | ||
metadata['index'], | ||
metadata['friendlyName'], | ||
|
||
|