diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-02-12 16:41:09 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-02-12 16:41:09 +0100 |
commit | 8bd82176356540b88eece24b96d7eb6a2260d718 (patch) | |
tree | 619caf62c174d09448e3da9c873b2df0d26dd5c2 /src/web/controllers/abstract.py | |
parent | New https certificate (diff) | |
download | newspipe-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.py | 12 |
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): |