aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db/base.py')
-rw-r--r--mediagoblin/db/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mediagoblin/db/base.py b/mediagoblin/db/base.py
index c0cefdc2..38375a69 100644
--- a/mediagoblin/db/base.py
+++ b/mediagoblin/db/base.py
@@ -31,12 +31,15 @@ class GMGTableBase(object):
# The key *has* to exist on sql.
return getattr(self, key)
- def save(self):
+ def save(self, commit=True):
sess = object_session(self)
if sess is None:
sess = Session()
sess.add(self)
- sess.commit()
+ if commit:
+ sess.commit()
+ else:
+ sess.flush()
def delete(self, commit=True):
"""Delete the object and commit the change immediately by default"""