We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 82d7c49 + bd49211 commit b7dfa6cCopy full SHA for b7dfa6c
docs/patterns/mongokit.rst
@@ -48,12 +48,14 @@ insert query to the next without any problem. MongoKit is just schemaless
48
too, but implements some validation to ensure data integrity.
49
50
Here is an example document (put this also into :file:`app.py`, e.g.)::
51
+ from mongokit import ValidationError
52
53
def max_length(length):
54
def validate(value):
55
if len(value) <= length:
56
return True
- raise Exception('%s must be at most %s characters long' % length)
57
+ # must have %s in error format string to have mongokit place key in there
58
+ raise ValidationError('%s must be at most {} characters long'.format(length))
59
return validate
60
61
class User(Document):
0 commit comments