aboutsummaryrefslogtreecommitdiff
path: root/src/web/controllers/abstract.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-02-12 16:41:09 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-02-12 16:41:09 +0100
commit8bd82176356540b88eece24b96d7eb6a2260d718 (patch)
tree619caf62c174d09448e3da9c873b2df0d26dd5c2 /src/web/controllers/abstract.py
parentNew https certificate (diff)
downloadnewspipe-8bd82176356540b88eece24b96d7eb6a2260d718.tar.gz
newspipe-8bd82176356540b88eece24b96d7eb6a2260d718.tar.bz2
newspipe-8bd82176356540b88eece24b96d7eb6a2260d718.zip
prototypefor bookmarks
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