aboutsummaryrefslogtreecommitdiff
path: root/src/web/controllers/abstract.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/controllers/abstract.py')
-rw-r--r--src/web/controllers/abstract.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/web/controllers/abstract.py b/src/web/controllers/abstract.py
index 3c91e08a..8563d5f2 100644
--- a/src/web/controllers/abstract.py
+++ b/src/web/controllers/abstract.py
@@ -98,14 +98,14 @@ class AbstractController:
def read(self, **filters):
return self._get(**filters)
- def update(self, filters, attrs):
+ def update(self, filters, attrs, return_objs=False, commit=True):
assert attrs, "attributes to update must not be empty"
- result = None
- try:
- result = self._get(**filters).update(attrs, synchronize_session=False)
+ result = self._get(**filters).update(attrs, synchronize_session=False)
+ if commit:
+ db.session.flush()
db.session.commit()
- except Exception as e:
- db.session.rollback()
+ if return_objs:
+ return self._get(**filters)
return result
def delete(self, obj_id):
bgstack15