Skip to content
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 viewlets on export #8

Merged
merged 1 commit into from
Mar 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plone/app/viewletmanager/exportimport/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions plone/app/viewletmanager/tests/test_exportimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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):
Expand Down