Skip to content

Commit

Permalink
Conditional support for assertions on save and delete (to be used car…
Browse files Browse the repository at this point in the history
…efully)
  • Loading branch information
joamag committed Jun 27, 2019
1 parent 382ed1b commit bae213b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/appier/model.py
Expand Up @@ -2157,6 +2157,7 @@ def assert_is_child(self, parent):
def save(
self,
validate = True,
verify = True,
is_new = None,
increment_a = None,
immutables_a = None,
Expand All @@ -2171,7 +2172,7 @@ def save(
):
# ensures that the current instance is associated with
# a concrete model, ready to be persisted in database
self.assert_is_concrete()
if verify: self.assert_is_concrete()

# checks if the instance to be saved is a new instance
# or if this is an update operation and then determines
Expand Down Expand Up @@ -2228,10 +2229,10 @@ def save(
# operation, this may be used for chaining operations
return self

def delete(self, pre_delete = True, post_delete = True):
def delete(self, verify = True, pre_delete = True, post_delete = True):
# ensures that the current instance is associated with
# a concrete model, ready to be persisted in database
self.assert_is_concrete()
if verify: self.assert_is_concrete()

# calls the complete set of event handlers for the current
# delete operation, this should trigger changes in the model
Expand Down

0 comments on commit bae213b

Please sign in to comment.