Small fix to ensure to use the right document after pre_save_post_validation hook, which might modify the document itself (e.g., for adding a etag).
This commit is contained in:
		| @@ -368,6 +368,8 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)): | |||||||
|  |  | ||||||
|         signals.pre_save_post_validation.send(self.__class__, document=self, |         signals.pre_save_post_validation.send(self.__class__, document=self, | ||||||
|                                               created=created, **signal_kwargs) |                                               created=created, **signal_kwargs) | ||||||
|  |         # it might be refreshed by the pre_save_post_validation hook, e.g., for etag generation | ||||||
|  |         doc = self.to_mongo() | ||||||
|  |  | ||||||
|         if self._meta.get('auto_create_index', True): |         if self._meta.get('auto_create_index', True): | ||||||
|             self.ensure_indexes() |             self.ensure_indexes() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user