From d2bc2537a12561880aa9779db5b1b4f7fd3826a5 Mon Sep 17 00:00:00 2001 From: posativ Date: Sun, 21 Oct 2012 22:37:39 +0200 Subject: [PATCH] remove limit, introduced unnecessary complexity --- isso/db.py | 6 +++--- specs/test_comment.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/isso/db.py b/isso/db.py index 24dbca7..22450b2 100644 --- a/isso/db.py +++ b/isso/db.py @@ -51,7 +51,7 @@ class Abstract: return @abc.abstractmethod - def retrieve(self, path, limit=20): + def retrieve(self, path, mode): return @@ -145,10 +145,10 @@ class SQLite(Abstract): (None, path, id)) return self.get(path, id) - def retrieve(self, path, limit=20, mode=1): + def retrieve(self, path, mode=1): with sqlite3.connect(self.dbpath) as con: rv = con.execute("SELECT * FROM comments WHERE path=? AND (? | mode) = ?" \ - + " ORDER BY id ASC LIMIT ?;", (path, mode, mode, limit)).fetchall() + + " ORDER BY id ASC;", (path, mode, mode)).fetchall() for item in rv: yield self.query2comment(item) diff --git a/specs/test_comment.py b/specs/test_comment.py index 4e5c51f..42aca49 100644 --- a/specs/test_comment.py +++ b/specs/test_comment.py @@ -53,7 +53,7 @@ class TestComments(unittest.TestCase): def testCreateAndGetMultiple(self): - for i in range(100): + for i in range(20): self.post('/comment/path/new', data=json.dumps(comment(text='Spam'))) r = self.get('/comment/path/') @@ -61,7 +61,6 @@ class TestComments(unittest.TestCase): rv = json.loads(r.data) assert len(rv) == 20 - # XXX limit=100 def testGetInvalid(self):