diff --git a/isso/db.py b/isso/db.py index 9e83e87..24dbca7 100644 --- a/isso/db.py +++ b/isso/db.py @@ -148,7 +148,7 @@ class SQLite(Abstract): def retrieve(self, path, limit=20, mode=1): with sqlite3.connect(self.dbpath) as con: rv = con.execute("SELECT * FROM comments WHERE path=? AND (? | mode) = ?" \ - + " ORDER BY id DESC LIMIT ?;", (path, mode, mode, limit)).fetchall() + + " ORDER BY id ASC LIMIT ?;", (path, mode, mode, limit)).fetchall() for item in rv: yield self.query2comment(item) diff --git a/specs/test_db.py b/specs/test_db.py index e5bb52d..602eb86 100644 --- a/specs/test_db.py +++ b/specs/test_db.py @@ -36,11 +36,11 @@ class TestSQLite(unittest.TestCase): self.db.add('/path/', comment(text='Baz')) rv = list(self.db.retrieve('/')) - assert rv[0].id == 2 - assert rv[0].text == 'Bar' + assert rv[0].id == 1 + assert rv[0].text == 'Foo' - assert rv[1].id == 1 - assert rv[1].text == 'Foo' + assert rv[1].id == 2 + assert rv[1].text == 'Bar' rv = list(self.db.retrieve('/path/')) assert rv[0].id == 1