Skip to content

MongoResultSet as bool #2

Description

@neithere

Use case:
{{{
if not User.find(db, {'email': form.email.data}):
raise wtforms.ValidationError(u'Unknown e-mail')
}}}
This does not work because {{{bool(MongoResultSet)}}} doesn't check whether the query yields any results. We need to call {{{.count()}}} or coerse the object to list. This should be done internally (probably via {{{.count()}}}).

Note: This issue has been automatically migrated from Bitbucket
Created by @neithere on 2012-02-07 16:18:27+00:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions