#65 Missing SearchSelection.__iter__ method

Severe bug
closed-fixed
None
5
2005-02-09
2005-02-09
No

The SearchSelection.__iter__ method has been overlooked during
refactoring, resulting in a loss of sort functionality whenever a
search has been done.

Discussion

  • Logged In: YES
    user_id=12534

    A Patch follows:

    diff -ur vergleich/Pyblio/Iterator.py stable/Pyblio/Iterator.py
    --- vergleich/Pyblio/Iterator.py 2005-02-09 18:39:44.000000000
    +0100
    +++ stable/Pyblio/Iterator.py 2005-02-08 16:21:15.000000000
    +0100
    @@ -29,8 +29,12 @@
    return self

    def __iter__ (self):
    - raise NotImplementedError
    -
    + retval = self.first ()
    + while retval != None:
    + yield retval
    + retval = self.next()
    + raise StopIteration
    +
    def set_position (self, pos=0):
    self._position = 0

    diff -ur vergleich/Pyblio/Selection.py stable/Pyblio/Selection.py
    --- vergleich/Pyblio/Selection.py 2005-02-09 18:39:44.000000000
    +0100
    +++ stable/Pyblio/Selection.py 2005-02-08 23:12:28.000000000
    +0100
    @@ -30,6 +30,14 @@
    self.iter = iterator
    return

    + def __iter__ (self):
    + test = self.search.match
    + for i in self.iter :
    + if test(i):
    + yield i
    + raise StopIteration
    +
    +

    def first (self):
    entry = self.iter.first ()

     
  • Logged In: YES
    user_id=12534

    This is now fixed in the arch repository.

     
    • status: open --> closed-fixed