Skip to content

Commit bd49211

Browse files
author
Jonathan Como
committed
verbage
1 parent a8498b6 commit bd49211

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/patterns/mongokit.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Here is an example document (put this also into :file:`app.py`, e.g.)::
5454
def validate(value):
5555
if len(value) <= length:
5656
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))
5859
return validate
5960

6061
class User(Document):
@@ -76,9 +77,7 @@ Here is an example document (put this also into :file:`app.py`, e.g.)::
7677

7778
This example shows you how to define your schema (named structure), a
7879
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
8281
dictionary but with `use_dot_notation` set to ``True`` you can use your
8382
documents like you use models in nearly any other ORM by using dots to
8483
separate between attributes.

0 commit comments

Comments
 (0)