File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ Here is an example document (put this also into :file:`app.py`, e.g.)::
54
54
def validate(value):
55
55
if len(value) <= length:
56
56
return True
57
- raise ValidationError('%s must be at most {0} characters long'.format(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))
58
59
return validate
59
60
60
61
class User(Document):
@@ -76,9 +77,7 @@ Here is an example document (put this also into :file:`app.py`, e.g.)::
76
77
77
78
This example shows you how to define your schema (named structure), a
78
79
validator for the maximum character length and uses a special MongoKit feature
79
- called `use_dot_notation `. When you define a ValidationError, you can add the `%s `
80
- into the format string to have the value placed in there for the final error message.
81
- ValueErrors can also be thrown as an alternative. Per default MongoKit behaves like a python
80
+ called `use_dot_notation `. Per default MongoKit behaves like a python
82
81
dictionary but with `use_dot_notation ` set to ``True `` you can use your
83
82
documents like you use models in nearly any other ORM by using dots to
84
83
separate between attributes.
You can’t perform that action at this time.
0 commit comments