Skip to content

Commit

Permalink
Stabilize order of unordered items in partial ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli authored and pbauer committed Sep 18, 2018
1 parent 16e6913 commit 4a970c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/plone/folder/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ def notifyRemoved(self, id):
def idsInOrder(self, onlyOrderables=False):
""" see interfaces.py """
ordered = list(self.order)
ordered_set = set(ordered)
if not onlyOrderables:
ids = aq_base(self.context).objectIds(ordered=False)
unordered = set(ids).difference(set(ordered))
ordered += list(unordered)
for id in ids:
if id not in ordered_set:
ordered.append(id)
return ordered

def moveObjectsByDelta(self, ids, delta, subset_ids=None,
Expand Down
2 changes: 1 addition & 1 deletion src/plone/folder/tests/test_partialordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create(self):
container['c2'] = Chaoticle('c2', 'mt2')
container['c3'] = Chaoticle('c3', 'mt1')
container['o4'] = Orderable('o4', 'mt2')
self.unordered = ['c3', 'c2', 'c1']
self.unordered = ['c1', 'c2', 'c3']
ordering = container.getOrdering()
return container, ordering

Expand Down

0 comments on commit 4a970c1

Please sign in to comment.