Moved pre_save after validation and determination of creation state; added pre_save_validation where pre_save had been.

This commit is contained in:
Alice Bevan-McGregor
2013-05-29 12:04:53 -04:00
parent c5ce96c391
commit 04592c876b
2 changed files with 5 additions and 2 deletions

View File

@@ -195,7 +195,7 @@ class Document(BaseDocument):
the cascade save using cascade_kwargs which overwrites the
existing kwargs with custom values
"""
signals.pre_save.send(self.__class__, document=self)
signals.pre_save_validation.send(self.__class__, document=self)
if validate:
self.validate(clean=clean)
@@ -206,7 +206,9 @@ class Document(BaseDocument):
doc = self.to_mongo()
created = ('_id' not in doc or self._created or force_insert)
signals.pre_save.send(self.__class__, document=self, created=created)
try:
collection = self._get_collection()
if created: