Skip to content

Commit

Permalink
Added argument checks for iterator.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekrau committed Nov 4, 2021
1 parent 8a53b71 commit 64ed2fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions couchdb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
and `tqdm`: https://tqdm.github.io/
"""

__version__ = "1.12.0"
__version__ = "1.12.1"

# Standard packages
import argparse
Expand Down Expand Up @@ -1011,9 +1011,13 @@ class _DatabaseIterator(object):
"Iterator over all documents, or all document identifiers, in a database."

def __init__(self, db, limit=CHUNK_SIZE, include_docs=True):
if not isinstance(limit, int):
raise ValueError("'limit' is not an 'int'")
if limit <= 0:
raise ValueError("'limit' must be positive")
self.db = db
self.params = {"include_docs": bool(include_docs),
"limit": int(limit),
"limit": limit,
"skip": 0}
self.chunk = []

Expand Down

0 comments on commit 64ed2fc

Please sign in to comment.