remove limit, introduced unnecessary complexity
This commit is contained in:
parent
3b197c4c3c
commit
d2bc2537a1
@ -51,7 +51,7 @@ class Abstract:
|
|||||||
return
|
return
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def retrieve(self, path, limit=20):
|
def retrieve(self, path, mode):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -145,10 +145,10 @@ class SQLite(Abstract):
|
|||||||
(None, path, id))
|
(None, path, id))
|
||||||
return self.get(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:
|
with sqlite3.connect(self.dbpath) as con:
|
||||||
rv = con.execute("SELECT * FROM comments WHERE path=? AND (? | mode) = ?" \
|
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:
|
for item in rv:
|
||||||
yield self.query2comment(item)
|
yield self.query2comment(item)
|
||||||
|
@ -53,7 +53,7 @@ class TestComments(unittest.TestCase):
|
|||||||
|
|
||||||
def testCreateAndGetMultiple(self):
|
def testCreateAndGetMultiple(self):
|
||||||
|
|
||||||
for i in range(100):
|
for i in range(20):
|
||||||
self.post('/comment/path/new', data=json.dumps(comment(text='Spam')))
|
self.post('/comment/path/new', data=json.dumps(comment(text='Spam')))
|
||||||
|
|
||||||
r = self.get('/comment/path/')
|
r = self.get('/comment/path/')
|
||||||
@ -61,7 +61,6 @@ class TestComments(unittest.TestCase):
|
|||||||
|
|
||||||
rv = json.loads(r.data)
|
rv = json.loads(r.data)
|
||||||
assert len(rv) == 20
|
assert len(rv) == 20
|
||||||
# XXX limit=100
|
|
||||||
|
|
||||||
def testGetInvalid(self):
|
def testGetInvalid(self):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user