-
-
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: 2017-04-06T11:14:22+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.app.upgrade@a0a4e19 Fixed ImportError when `Products.ATContentTypes` is not available. This happens when you only have the `Products.CMFPlone` egg and not the `Plone` egg. See https://community.plone.org/t/plone-5-1b3-soft-released/3936/5 Traceback was: File "/home/vagrant/Eggs/plone.app.upgrade-2.0.2-py2.7.egg/plone/app/upgrade/__init__.py", line 111, in <module> from Products.ATContentTypes.tool import metadata zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/vagrant/www.fhnw.ch/parts/instance1v/etc/site.zcml", line 12.2-12.39 ZopeXMLConfigurationError: File "/home/vagrant/Eggs/Products.CMFPlone-5.1b3-py2.7.egg/Products/CMFPlone/meta.zcml", line 47.4-51.10 ImportError: No module named ATContentTypes.tool I fixed that with the already available atcontenttypes_bbb module. Then the next traceback surfaced: ZopeXMLConfigurationError: File "/Users/maurits/community/plone-coredev/5.1/src/plone.app.upgrade/plone/app/upgrade/v40/configure.zcml", line 172.8-176.14 ConfigurationError: ('Invalid value for', 'handler', "ImportError: Couldn't import Products.CMFDefault.upgrade.to22, No module named upgrade.to22") This is because my fix turned Products.CMFDefault into an aliased module, which caused the conditionally registered upgrade step to be loaded, causing an error. I fixed this by making a wrapper around the original CMFDefault upgrade step. Note that this will only be called when someone upgrades from a Plone 4.0 alpha release to Plone 5, which seems unlikely. Files changed: M CHANGES.rst M plone/app/upgrade/__init__.py M plone/app/upgrade/v40/alphas.py M plone/app/upgrade/v40/configure.zcml Repository: plone.app.upgrade Branch: refs/heads/master Date: 2017-04-06T18:06:44+02:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/plone.app.upgrade@2b08e22 Merge pull request #109 from plone/fix-importerrors-atcontenttypes-cmfdefault Fixed ImportError when `Products.ATContentTypes` is not available. Files changed: M CHANGES.rst M plone/app/upgrade/__init__.py M plone/app/upgrade/v40/alphas.py M plone/app/upgrade/v40/configure.zcml
- Loading branch information
Showing
1 changed file
with
168 additions
and
53 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,92 +1,207 @@ | ||
Repository: plone.app.caching | ||
Repository: plone.app.upgrade | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-04-05T23:05:59+02:00 | ||
Date: 2017-04-06T11:14:22+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.app.caching/commit/cd17acfcc3b27cae247f521e4d95fabcd682a650 | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/a0a4e197b9861ddafe21a95896072a1a6d881a62 | ||
|
||
Fixed blank edit forms of the per ruleset parameters. | ||
Fixed ImportError when `Products.ATContentTypes` is not available. | ||
|
||
Fixes https://github.com/plone/Products.CMFPlone/issues/1993 | ||
This happens when you only have the `Products.CMFPlone` egg and not the `Plone` egg. | ||
See https://community.plone.org/t/plone-5-1b3-soft-released/3936/5 | ||
Traceback was: | ||
|
||
File "/home/vagrant/Eggs/plone.app.upgrade-2.0.2-py2.7.egg/plone/app/upgrade/__init__.py", line 111, in <module> | ||
from Products.ATContentTypes.tool import metadata | ||
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/vagrant/www.fhnw.ch/parts/instance1v/etc/site.zcml", line 12.2-12.39 | ||
ZopeXMLConfigurationError: File "/home/vagrant/Eggs/Products.CMFPlone-5.1b3-py2.7.egg/Products/CMFPlone/meta.zcml", line 47.4-51.10 | ||
ImportError: No module named ATContentTypes.tool | ||
|
||
I fixed that with the already available atcontenttypes_bbb module. | ||
|
||
Then the next traceback surfaced: | ||
|
||
ZopeXMLConfigurationError: File "/Users/maurits/community/plone-coredev/5.1/src/plone.app.upgrade/plone/app/upgrade/v40/configure.zcml", line 172.8-176.14 | ||
ConfigurationError: ('Invalid value for', 'handler', "ImportError: Couldn't import Products.CMFDefault.upgrade.to22, No module named upgrade.to22") | ||
|
||
This is because my fix turned Products.CMFDefault into an aliased module, | ||
which caused the conditionally registered upgrade step to be loaded, causing an error. | ||
I fixed this by making a wrapper around the original CMFDefault upgrade step. | ||
|
||
Note that this will only be called when someone upgrades from a Plone 4.0 alpha release to Plone 5, which seems unlikely. | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/app/caching/browser/edit.py | ||
M plone/app/upgrade/__init__.py | ||
M plone/app/upgrade/v40/alphas.py | ||
M plone/app/upgrade/v40/configure.zcml | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 9ca6edc..415d46d 100644 | ||
index 38ef4a8..83b00cd 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -14,7 +14,9 @@ New features: | ||
@@ -14,6 +14,10 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
-- *add item here* | ||
+- Fixed blank edit forms of the per ruleset parameters. | ||
+ `Issue 1993 <https://github.com/plone/Products.CMFPlone/issues/1993>`_. | ||
+ [maurits] | ||
+- Fixed ImportError when ``Products.ATContentTypes`` is not available. | ||
+ This happens when you only have the ``Products.CMFPlone`` egg | ||
+ and not the ``Plone`` egg. [maurits] | ||
+ | ||
- Fixed title and description of plone.resource.maxage. | ||
This had the title and description from shared maxage, | ||
due to a wrong reference. | ||
diff --git a/plone/app/upgrade/__init__.py b/plone/app/upgrade/__init__.py | ||
index 2ac8522..7f87a09 100644 | ||
--- a/plone/app/upgrade/__init__.py | ||
+++ b/plone/app/upgrade/__init__.py | ||
@@ -108,8 +108,14 @@ def getNonInstallableProducts(self): | ||
import Products.CMFDefault.MetadataTool | ||
Products.CMFDefault.MetadataTool # pyflakes | ||
except ImportError: | ||
- from Products.ATContentTypes.tool import metadata | ||
- sys.modules['Products.CMFDefault.MetadataTool'] = metadata | ||
+ try: | ||
+ pkg_resources.get_distribution('Products.ATContentTypes') | ||
+ except: | ||
+ from plone.app.upgrade import atcontentypes_bbb | ||
+ alias_module('Products.CMFDefault.MetadataTool', atcontentypes_bbb) | ||
+ else: | ||
+ from Products.ATContentTypes.tool import metadata | ||
+ sys.modules['Products.CMFDefault.MetadataTool'] = metadata | ||
|
||
try: | ||
import Products.CMFDefault.SyndicationInfo | ||
diff --git a/plone/app/upgrade/v40/alphas.py b/plone/app/upgrade/v40/alphas.py | ||
index 5a6a9e4..c1aee55 100644 | ||
--- a/plone/app/upgrade/v40/alphas.py | ||
+++ b/plone/app/upgrade/v40/alphas.py | ||
@@ -599,3 +599,19 @@ def installNewModifiers(context): | ||
if modifiers is not None: | ||
install(modifiers) | ||
logger.info('Added new CMFEditions modifiers.') | ||
+ | ||
+ | ||
+def run_upgrade_dcmi_metadata(tool): | ||
+ """Run the upgrade_dcmi_metadata step from CMFDefault. | ||
+ | ||
+ This is only run if CMFDefault is 'installed' (importable). | ||
+ But in Plone 5 it may still be there as aliased module, | ||
+ missing the upgrade module. So we have a small wrapper around it, | ||
+ to avoid an ImportError on startup. | ||
+ """ | ||
+ try: | ||
+ from Products.CMFDefault.upgrade.to22 import upgrade_dcmi_metadata | ||
+ except ImportError: | ||
+ logger.info('Original CMFDefault DCMI upgrade step not available.') | ||
+ return | ||
+ upgrade_dcmi_metadata(tool) | ||
diff --git a/plone/app/upgrade/v40/configure.zcml b/plone/app/upgrade/v40/configure.zcml | ||
index 714d9da..3c8539e 100644 | ||
--- a/plone/app/upgrade/v40/configure.zcml | ||
+++ b/plone/app/upgrade/v40/configure.zcml | ||
@@ -172,7 +172,7 @@ | ||
<genericsetup:upgradeStep | ||
zcml:condition="installed Products.CMFDefault" | ||
title="Upgrade DCMI metadata storage in portal_metadata" | ||
- handler="Products.CMFDefault.upgrade.to22.upgrade_dcmi_metadata" | ||
+ handler=".alphas.run_upgrade_dcmi_metadata" | ||
/> | ||
|
||
1.2.17 (2017-04-02) | ||
diff --git a/plone/app/caching/browser/edit.py b/plone/app/caching/browser/edit.py | ||
index fb67701..f7e72d7 100644 | ||
--- a/plone/app/caching/browser/edit.py | ||
+++ b/plone/app/caching/browser/edit.py | ||
@@ -159,7 +159,7 @@ def getContent(self): | ||
# as necessary in applyChanges() | ||
|
||
if self.rulesetName: | ||
- rulesetRecordName = '{0}{1}{2}'.format( | ||
+ rulesetRecordName = '{0}.{1}.{2}'.format( | ||
prefix, self.rulesetName, option,) | ||
|
||
if rulesetRecordName in self.registry.records: | ||
<genericsetup:upgradeStep | ||
|
||
|
||
Repository: plone.app.caching | ||
Repository: plone.app.upgrade | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2017-04-06T10:32:04+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.app.caching/commit/ac8b6a88a35478e372d577029226fe9929e63fdb | ||
Date: 2017-04-06T18:06:44+02:00 | ||
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> | ||
Commit: https://github.com/plone/plone.app.upgrade/commit/2b08e22289a8a1bed3984918b0928105973cb841 | ||
|
||
Merge pull request #36 from plone/issue-1993-blank-edit-forms | ||
Merge pull request #109 from plone/fix-importerrors-atcontenttypes-cmfdefault | ||
|
||
Fixed blank edit forms of the per ruleset parameters. | ||
Fixed ImportError when `Products.ATContentTypes` is not available. | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M plone/app/caching/browser/edit.py | ||
M plone/app/upgrade/__init__.py | ||
M plone/app/upgrade/v40/alphas.py | ||
M plone/app/upgrade/v40/configure.zcml | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 9ca6edc..415d46d 100644 | ||
index 38ef4a8..83b00cd 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -14,7 +14,9 @@ New features: | ||
@@ -14,6 +14,10 @@ New features: | ||
|
||
Bug fixes: | ||
|
||
-- *add item here* | ||
+- Fixed blank edit forms of the per ruleset parameters. | ||
+ `Issue 1993 <https://github.com/plone/Products.CMFPlone/issues/1993>`_. | ||
+ [maurits] | ||
|
||
|
||
1.2.17 (2017-04-02) | ||
diff --git a/plone/app/caching/browser/edit.py b/plone/app/caching/browser/edit.py | ||
index fb67701..f7e72d7 100644 | ||
--- a/plone/app/caching/browser/edit.py | ||
+++ b/plone/app/caching/browser/edit.py | ||
@@ -159,7 +159,7 @@ def getContent(self): | ||
# as necessary in applyChanges() | ||
+- Fixed ImportError when ``Products.ATContentTypes`` is not available. | ||
+ This happens when you only have the ``Products.CMFPlone`` egg | ||
+ and not the ``Plone`` egg. [maurits] | ||
+ | ||
- Fixed title and description of plone.resource.maxage. | ||
This had the title and description from shared maxage, | ||
due to a wrong reference. | ||
diff --git a/plone/app/upgrade/__init__.py b/plone/app/upgrade/__init__.py | ||
index 2ac8522..7f87a09 100644 | ||
--- a/plone/app/upgrade/__init__.py | ||
+++ b/plone/app/upgrade/__init__.py | ||
@@ -108,8 +108,14 @@ def getNonInstallableProducts(self): | ||
import Products.CMFDefault.MetadataTool | ||
Products.CMFDefault.MetadataTool # pyflakes | ||
except ImportError: | ||
- from Products.ATContentTypes.tool import metadata | ||
- sys.modules['Products.CMFDefault.MetadataTool'] = metadata | ||
+ try: | ||
+ pkg_resources.get_distribution('Products.ATContentTypes') | ||
+ except: | ||
+ from plone.app.upgrade import atcontentypes_bbb | ||
+ alias_module('Products.CMFDefault.MetadataTool', atcontentypes_bbb) | ||
+ else: | ||
+ from Products.ATContentTypes.tool import metadata | ||
+ sys.modules['Products.CMFDefault.MetadataTool'] = metadata | ||
|
||
if self.rulesetName: | ||
- rulesetRecordName = '{0}{1}{2}'.format( | ||
+ rulesetRecordName = '{0}.{1}.{2}'.format( | ||
prefix, self.rulesetName, option,) | ||
try: | ||
import Products.CMFDefault.SyndicationInfo | ||
diff --git a/plone/app/upgrade/v40/alphas.py b/plone/app/upgrade/v40/alphas.py | ||
index 5a6a9e4..c1aee55 100644 | ||
--- a/plone/app/upgrade/v40/alphas.py | ||
+++ b/plone/app/upgrade/v40/alphas.py | ||
@@ -599,3 +599,19 @@ def installNewModifiers(context): | ||
if modifiers is not None: | ||
install(modifiers) | ||
logger.info('Added new CMFEditions modifiers.') | ||
+ | ||
+ | ||
+def run_upgrade_dcmi_metadata(tool): | ||
+ """Run the upgrade_dcmi_metadata step from CMFDefault. | ||
+ | ||
+ This is only run if CMFDefault is 'installed' (importable). | ||
+ But in Plone 5 it may still be there as aliased module, | ||
+ missing the upgrade module. So we have a small wrapper around it, | ||
+ to avoid an ImportError on startup. | ||
+ """ | ||
+ try: | ||
+ from Products.CMFDefault.upgrade.to22 import upgrade_dcmi_metadata | ||
+ except ImportError: | ||
+ logger.info('Original CMFDefault DCMI upgrade step not available.') | ||
+ return | ||
+ upgrade_dcmi_metadata(tool) | ||
diff --git a/plone/app/upgrade/v40/configure.zcml b/plone/app/upgrade/v40/configure.zcml | ||
index 714d9da..3c8539e 100644 | ||
--- a/plone/app/upgrade/v40/configure.zcml | ||
+++ b/plone/app/upgrade/v40/configure.zcml | ||
@@ -172,7 +172,7 @@ | ||
<genericsetup:upgradeStep | ||
zcml:condition="installed Products.CMFDefault" | ||
title="Upgrade DCMI metadata storage in portal_metadata" | ||
- handler="Products.CMFDefault.upgrade.to22.upgrade_dcmi_metadata" | ||
+ handler=".alphas.run_upgrade_dcmi_metadata" | ||
/> | ||
|
||
if rulesetRecordName in self.registry.records: | ||
<genericsetup:upgradeStep | ||
|
||
|