Fixed index bugs.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 30 Mar 2015 01:13:41 +0000 (03:13 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 30 Mar 2015 01:13:41 +0000 (03:13 +0200)
didex/index.py

index 30dcfdf..2844de0 100644 (file)
@@ -155,7 +155,7 @@ class ordered(index, lib.closable):
 
         def _decode(self, d):
             k, v = d
-            k = self.type.decode(k)
+            k = self.typ.decode(k)
             v = struct.unpack(">Q", v)[0]
             return k, v
 
@@ -212,13 +212,13 @@ class ordered(index, lib.closable):
                 self.item = StopIteration
 
         def __next__(self):
-            if self.item is StopIteration:
-                raise StopIteration()
             if self.item is None:
                 if not self.rev:
                     self.next()
                 else:
                     self.prev()
+            if self.item is StopIteration:
+                raise StopIteration()
             ret, self.item = self.item, None
             return ret