Answer the question
In order to leave comments, you need to log in
How to overcome the error "OverflowError: signed integer is greater than maximum"?
Here is the documentation for flask-mongoengine
docs.mongoengine.org/projects/flask-mongoengine/en...
And there is a paragraph about pagination:
paginated_todos = Todo.objects.paginate(page=page, per_page=10)
OverflowError: signed integer is greater than maximum
Python int too large to convert to C long
try:
paginated_todos = Todo.objects.paginate(page=page, per_page=10)
except:
abort(404)
Answer the question
In order to leave comments, you need to log in
You can write a function similar to the above doc:
# Paginate through todo
def view_todos(page=1):
paginated_todos = Todo.objects.paginate(page=page, per_page=10)
And inside this function check for errors
def view_todos (page=1):
try:
return Todo.objects.paginate(page=page, per_page=10)
except:
abort(404)
And then use the view_todos function everywhere in your code, then you won't have to clone the code.
In fact, it turns out a decorator for the pagination function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question