aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/sql/base.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-11-28 16:45:15 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2012-11-28 16:45:15 +0100
commitefb70b529f3c04054e4453144155b18a8400281b (patch)
tree01af6bbe92b465b60f9ef90a4a18e6d09f3d5615 /mediagoblin/db/sql/base.py
parent0d599e5341cd78be5d4d6801fab46492ef50036d (diff)
parent9437ea4742eecb6854810fe020fe721b413da276 (diff)
downloadmediagoblin-efb70b529f3c04054e4453144155b18a8400281b.tar.lz
mediagoblin-efb70b529f3c04054e4453144155b18a8400281b.tar.xz
mediagoblin-efb70b529f3c04054e4453144155b18a8400281b.zip
Merge some small bits by spaetz. Needed later.
* commit '9437ea4742': Add commit argument to clean_orphan_tags Add "commit" argument to Base model delete()
Diffstat (limited to 'mediagoblin/db/sql/base.py')
-rw-r--r--mediagoblin/db/sql/base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py
index 838080b0..e10e7739 100644
--- a/mediagoblin/db/sql/base.py
+++ b/mediagoblin/db/sql/base.py
@@ -79,11 +79,13 @@ class GMGTableBase(object):
sess.add(self)
sess.commit()
- def delete(self):
+ def delete(self, commit=True):
+ """Delete the object and commit the change immediately by default"""
sess = object_session(self)
assert sess is not None, "Not going to delete detached %r" % self
sess.delete(self)
- sess.commit()
+ if commit:
+ sess.commit()
Base = declarative_base(cls=GMGTableBase)