Minor text and comments enhancements
This commit is contained in:
		| @@ -308,7 +308,9 @@ class Document(BaseDocument): | |||||||
|                     object_id = collection.insert(doc, **write_concern) |                     object_id = collection.insert(doc, **write_concern) | ||||||
|                 else: |                 else: | ||||||
|                     object_id = collection.save(doc, **write_concern) |                     object_id = collection.save(doc, **write_concern) | ||||||
|                     # Pymongo 3.0 bug, fix scheduled for 3.0.1 |                     # TODO: Pymongo 3.0 bug, fix scheduled for 3.0.1 | ||||||
|  |                     # In PyMongo 3.0, the save() call calls internally the _update() call | ||||||
|  |                     # but they forget to return the _id value passed back, therefore getting it back here | ||||||
|                     if not object_id and pymongo.version_tuple == (3, 0): |                     if not object_id and pymongo.version_tuple == (3, 0): | ||||||
|                         object_id = self._qs.filter(**self._object_key).first() and \ |                         object_id = self._qs.filter(**self._object_key).first() and \ | ||||||
|                                     self._qs.filter(**self._object_key).first().pk |                                     self._qs.filter(**self._object_key).first().pk | ||||||
|   | |||||||
| @@ -930,6 +930,7 @@ class BaseQuerySet(object): | |||||||
|             plan = pprint.pformat(plan) |             plan = pprint.pformat(plan) | ||||||
|         return plan |         return plan | ||||||
|  |  | ||||||
|  |     # DEPRECATED. Has no more impact on PyMongo 3+ | ||||||
|     def snapshot(self, enabled): |     def snapshot(self, enabled): | ||||||
|         """Enable or disable snapshot mode when querying. |         """Enable or disable snapshot mode when querying. | ||||||
|  |  | ||||||
| @@ -1419,7 +1420,8 @@ class BaseQuerySet(object): | |||||||
|                 cursor_args['slave_okay'] = self._slave_okay |                 cursor_args['slave_okay'] = self._slave_okay | ||||||
|         else: |         else: | ||||||
|             fields_name = 'projection' |             fields_name = 'projection' | ||||||
|             # snapshot seems not to be handled at all by PyMongo 3+ |             # snapshot is not to handled at all by PyMongo 3+ | ||||||
|  |             # TODO: raise a warning? | ||||||
|             cursor_args = { |             cursor_args = { | ||||||
|                 'no_cursor_timeout': self._timeout |                 'no_cursor_timeout': self._timeout | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -2491,7 +2491,8 @@ class FieldTest(unittest.TestCase): | |||||||
|         binary_id = uuid.uuid4().bytes |         binary_id = uuid.uuid4().bytes | ||||||
|         att = Attachment(id=binary_id).save() |         att = Attachment(id=binary_id).save() | ||||||
|         self.assertEqual(1, Attachment.objects.count()) |         self.assertEqual(1, Attachment.objects.count()) | ||||||
|         self.assertNotEqual(None, Attachment.objects.filter(id=binary_id).first()) |         # TODO use assertIsNotNone once Python 2.6 support is dropped | ||||||
|  |         self.assertFalse(Attachment.objects.filter(id=binary_id).first() is not None) | ||||||
|         att.delete() |         att.delete() | ||||||
|         self.assertEqual(0, Attachment.objects.count()) |         self.assertEqual(0, Attachment.objects.count()) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user