MergeableList.remove() and pop() do not remove keys from _order

Bug #552646 reported by Eric Casteleijn
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
desktopcouch
Invalid
Medium
Unassigned

Bug Description

These:

    def remove(self, value):
        if len(self) == 1:
            raise ValueError("MergeableList cannot be empty.")
        index = 0
        for current_value in self:
            # important! use the data in self first 'cause mergeable lists
            # can be compared with list and tuples but no the other way around
            if cmp(current_value, value) == 0:
                del self[index]
                return
            index += 1
        raise ValueError("list.remove(x): x not in list")

    def pop(self, index):
        if len(self) == 1:
            raise ValueError("MergeableList cannot be empty.")
        value = self[index]
        del self[index]
        return value

do not update self._order, which means uuids are left hanging there. This results in errors in self._get_ordered_keys(), which is used by a lot of the API...

Changed in desktopcouch:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Eric Casteleijn (thisfred) wrote :

This is in fact entirely in correct: del self[index] goes through the API, and properly removes the key from the ._order list. The error we hit on the server must have a different cause...

Changed in desktopcouch:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.