Skip to content

Commit

Permalink
Sort viewlets on export
Browse files Browse the repository at this point in the history
Fixes: #7
  • Loading branch information
gforcada committed Mar 4, 2015
1 parent fba1f58 commit 202f845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 202f845

Please sign in to comment.