Added pre_save_post_validation signal (#345)
This commit is contained in:
parent
ef4b32aca7
commit
4244e7569b
5 changed files with 26 additions and 25 deletions
|
|
@ -195,7 +195,7 @@ class Document(BaseDocument):
|
|||
the cascade save using cascade_kwargs which overwrites the
|
||||
existing kwargs with custom values
|
||||
"""
|
||||
signals.pre_save_validation.send(self.__class__, document=self)
|
||||
signals.pre_save.send(self.__class__, document=self)
|
||||
|
||||
if validate:
|
||||
self.validate(clean=clean)
|
||||
|
|
@ -206,9 +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)
|
||||
|
||||
|
||||
signals.pre_save_post_validation.send(self.__class__, document=self, created=created)
|
||||
|
||||
try:
|
||||
collection = self._get_collection()
|
||||
if created:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
__all__ = ['pre_init', 'post_init', 'pre_save_validation', 'pre_save',
|
||||
__all__ = ['pre_init', 'post_init', 'pre_save', 'pre_save_post_validation',
|
||||
'post_save', 'pre_delete', 'post_delete']
|
||||
|
||||
signals_available = False
|
||||
|
|
@ -38,8 +38,8 @@ _signals = Namespace()
|
|||
|
||||
pre_init = _signals.signal('pre_init')
|
||||
post_init = _signals.signal('post_init')
|
||||
pre_save_validation = _signals.signal('pre_save_validation')
|
||||
pre_save = _signals.signal('pre_save')
|
||||
pre_save_post_validation = _signals.signal('pre_save_post_validation')
|
||||
post_save = _signals.signal('post_save')
|
||||
pre_delete = _signals.signal('pre_delete')
|
||||
post_delete = _signals.signal('post_delete')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue