-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort viewlet managers on export #7
Comments
gforcada
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 4, 2015
Branch: refs/heads/master Date: 2015-03-04T16:47:50+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@9171d6e Sort viewlets on export Fixes: plone/plone.app.viewletmanager#7 Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self):
gforcada
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 4, 2015
Branch: refs/heads/master Date: 2015-03-04T16:47:50+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@9171d6e Sort viewlets on export Fixes: plone/plone.app.viewletmanager#7 Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self):
gforcada
added a commit
to derFreitag/plone.app.viewletmanager
that referenced
this issue
Mar 4, 2015
Merged
davisagli
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 5, 2015
Branch: refs/heads/master Date: 2015-03-04T17:02:19+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@202f845 Sort viewlets on export Fixes: plone/plone.app.viewletmanager#7 Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self): Repository: plone.app.viewletmanager Branch: refs/heads/master Date: 2015-03-05T15:13:06-08:00 Author: David Glick (davisagli) <david.glick@plone.org> Commit: plone/plone.app.viewletmanager@41dfe3c Merge pull request #8 from derFreitag/master Sort viewlets on export Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self):
davisagli
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 5, 2015
Branch: refs/heads/master Date: 2015-03-04T17:02:19+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@202f845 Sort viewlets on export Fixes: plone/plone.app.viewletmanager#7 Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self): Repository: plone.app.viewletmanager Branch: refs/heads/master Date: 2015-03-05T15:13:06-08:00 Author: David Glick (davisagli) <david.glick@plone.org> Commit: plone/plone.app.viewletmanager@41dfe3c Merge pull request #8 from derFreitag/master Sort viewlets on export Files changed: M plone/app/viewletmanager/exportimport/storage.py M plone/app/viewletmanager/tests/test_exportimport.py diff --git a/plone/app/viewletmanager/exportimport/storage.py b/plone/app/viewletmanager/exportimport/storage.py index 3e0b500..22c1d2f 100644 --- a/plone/app/viewletmanager/exportimport/storage.py +++ b/plone/app/viewletmanager/exportimport/storage.py @@ -123,8 +123,8 @@ def _exportNode(self): output = self._doc.createElement('object') for nodename in ('order', 'hidden'): skins = getattr(self.context, '_'+nodename) - for skin in skins: - for name in skins[skin]: + for skin in sorted(skins): + for name in sorted(skins[skin]): node = self._doc.createElement(nodename) node.setAttribute('skinname', skin) node.setAttribute('manager', name) diff --git a/plone/app/viewletmanager/tests/test_exportimport.py b/plone/app/viewletmanager/tests/test_exportimport.py index 8839c06..d9db226 100644 --- a/plone/app/viewletmanager/tests/test_exportimport.py +++ b/plone/app/viewletmanager/tests/test_exportimport.py @@ -42,14 +42,14 @@ _VIEWLETS_XML = """\ <?xml version="1.0"?> <object> + <order manager="top" skinname="basic"> + <viewlet name="one"/> + </order> <order manager="top" skinname="fancy"> <viewlet name="two"/> <viewlet name="three"/> <viewlet name="one"/> </order> - <order manager="top" skinname="basic"> - <viewlet name="one"/> - </order> <hidden manager="top" skinname="light"> <viewlet name="two"/> </hidden> @@ -353,11 +353,11 @@ def test_normal(self): context._files['viewlets.xml'] = self._VIEWLETS_XML importViewletSettingsStorage(context) - self.assertEqual(utility.getOrder('top', 'fancy'), - ('two', 'three', 'one')) + self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getOrder('top', 'undefined (fallback)'), + ('one', )) + self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'three', 'one')) - self.assertEqual(utility.getOrder('top', 'basic'), ('one', )) self.assertEqual(utility.getHidden('top', 'light'), ('two', )) def test_fragment_skip_purge(self):
gforcada
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 5, 2015
Branch: refs/heads/master Date: 2015-03-06T00:20:45+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@9aaea9f Update CHANGES.rst Add changelog entry regarding plone/plone.app.viewletmanager#7 Files changed: M CHANGES.rst diff --git a/CHANGES.rst b/CHANGES.rst index ccfebcd..74d558b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,10 @@ Changelog - flake8 fixes and general cleanup. [gforcada] +- Sort skins and viewletmanagers on exports to create stable exports. + This fixes: plone/plone.app.viewletmanager#7 + [gforcada] + 2.0.6 (2014-07-10) ------------------
gforcada
added a commit
to plone/buildout.coredev
that referenced
this issue
Mar 5, 2015
Branch: refs/heads/master Date: 2015-03-06T00:20:45+01:00 Author: Gil Forcada (gforcada) <gforcada@gnome.org> Commit: plone/plone.app.viewletmanager@9aaea9f Update CHANGES.rst Add changelog entry regarding plone/plone.app.viewletmanager#7 Files changed: M CHANGES.rst diff --git a/CHANGES.rst b/CHANGES.rst index ccfebcd..74d558b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,10 @@ Changelog - flake8 fixes and general cleanup. [gforcada] +- Sort skins and viewletmanagers on exports to create stable exports. + This fixes: plone/plone.app.viewletmanager#7 + [gforcada] + 2.0.6 (2014-07-10) ------------------
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sort skins and viewletmanagers alphabetically would help a lot when you have to compare a fresh installation of a plone site with its production counterpart.
As the later (production) most probably has seen quite a few updates on the viewlets here and there the xml produced by p.a.viewletmanager is completely different at first sight, but as you keep copying and pasting xml snippets around it makes them equal or nearly so.
The text was updated successfully, but these errors were encountered: