File tree 4 files changed +106
-9
lines changed
4 files changed +106
-9
lines changed Original file line number Diff line number Diff line change 1
- * ~
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__ /
2
3
* .py [cod ]
3
- .DS *
4
- cover /
5
- dist /
4
+ * $py.class
5
+
6
+ # C extensions
7
+ * .so
8
+
9
+ # Distribution / packaging
10
+ .Python
6
11
build /
12
+ develop-eggs /
13
+ dist /
14
+ downloads /
15
+ eggs /
16
+ .eggs /
17
+ lib /
18
+ lib64 /
19
+ parts /
20
+ sdist /
21
+ var /
22
+ wheels /
23
+ * .egg-info /
24
+ .installed.cfg
25
+ * .egg
26
+ MANIFEST
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ * .manifest
32
+ * .spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov /
40
+ .tox /
7
41
.coverage
8
- * .egg *
42
+ .coverage. *
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ * .cover
47
+ .hypothesis /
48
+ .pytest_cache /
49
+ cover /
50
+
51
+ # Translations
52
+ * .mo
53
+ * .pot
54
+
55
+ # Django stuff:
56
+ * .log
57
+ local_settings.py
58
+ db.sqlite3
59
+
60
+ # Flask stuff:
61
+ instance /
62
+ .webassets-cache
63
+
64
+ # Scrapy stuff:
65
+ .scrapy
66
+
67
+ # Sphinx documentation
68
+ docs /_build /
69
+
70
+ # PyBuilder
71
+ target /
72
+
73
+ # Jupyter Notebook
74
+ .ipynb_checkpoints
75
+
76
+ # pyenv
77
+ .python-version
78
+
79
+ # celery beat schedule file
80
+ celerybeat-schedule
81
+
82
+ # SageMath parsed files
83
+ * .sage.py
84
+
85
+ # Environments
86
+ .env
87
+ .venv
88
+ env /
89
+ venv /
90
+ ENV /
91
+ env.bak /
92
+ venv.bak /
93
+
94
+ # Spyder project settings
95
+ .spyderproject
96
+ .spyproject
97
+
98
+ # Rope project settings
99
+ .ropeproject
100
+
101
+ # mkdocs documentation
102
+ /site
103
+
104
+ # mypy
105
+ .mypy_cache /
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ def insert(self, **kwargs):
378
378
:meth:`~run_auto_updates()` and :meth:`~validate_all()` """
379
379
self .run_auto_updates ()
380
380
self .validate_all ()
381
- id_or_ids = self .get_collection ().insert (self , ** kwargs )
381
+ id_or_ids = self .get_collection ().insert_one (self , ** kwargs )
382
382
self .reset_diff ()
383
383
for field_name , field_value in self .items ():
384
384
if isinstance (field_value , dict ): # cast dicts
@@ -412,7 +412,7 @@ def save(self, **kwargs):
412
412
if not diff :
413
413
self .reset_diff ()
414
414
return
415
- response = self .get_collection ().update (query , diff , ** kwargs )
415
+ response = self .get_collection ().update_one (query , diff , ** kwargs )
416
416
self .reset_diff ()
417
417
return response
418
418
Original file line number Diff line number Diff line change 11
11
12
12
class Field (object ):
13
13
"""Instances of this class is used to define field types and automatically
14
- create validators. Note that a Field definition has no value added ::
14
+ create validators::
15
15
16
16
field_name = Field(str, default='cheeseburger')
17
17
foo = Field(datetime, auto_update=True)
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ class Doc(BaseDocument):
265
265
self .assertRaises (ValidationError , d .save ) # _id manually set
266
266
self .assertRaises (ValidationError , d .insert ) # missing field moo
267
267
d .moo = []
268
- self .assertEqual (d ._id , d .insert ())
268
+ self .assertEqual (d ._id , d .insert (). inserted_id )
269
269
del d .bar # unset
270
270
d .save ()
271
271
self .assertEqual (d , Doc .find_one (d ._id ))
You can’t perform that action at this time.
0 commit comments