Skip to content

Commit

Permalink
initial support for default limit of result to 10
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Oct 29, 2015
1 parent 10e5489 commit 99034a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/quorum/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def get(cls, *args, **kwargs):
("build", True),
("fill", True),
("skip", 0),
("limit", 0),
("limit", 10),
("sort", None),
("raise_e", True)
))
Expand Down Expand Up @@ -478,7 +478,7 @@ def find(cls, *args, **kwargs):
("build", True),
("fill", True),
("skip", 0),
("limit", 0),
("limit", 10),
("sort", None)
))

Expand Down
7 changes: 6 additions & 1 deletion src/quorum/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@

defines = defines

def to_limit(limit_s):
limit = int(limit_s)
if limit < 0: return 0
return limit

def to_find(find_s):
if not find_s: return []
find_t = type(find_s)
Expand Down Expand Up @@ -96,7 +101,7 @@ def to_sort(sort_s):

FIND_TYPES = dict(
skip = int,
limit = int,
limit = to_limit,
find_s = legacy.UNICODE,
find_d = to_find,
find_i = bool,
Expand Down

0 comments on commit 99034a8

Please sign in to comment.