[csw-devel] SF.net SVN: gar:[12129] csw/mgar/gar/v2/lib/python/models.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Thu Dec 30 03:48:58 CET 2010
Revision: 12129
http://gar.svn.sourceforge.net/gar/?rev=12129&view=rev
Author: wahwah
Date: 2010-12-30 02:48:58 +0000 (Thu, 30 Dec 2010)
Log Message:
-----------
checkpkg: srv4 objs can delete all dependent objs
Useful when removing a srv4 object from the database. We'll use it later
during garbage collection.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/models.py
Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py 2010-12-30 02:48:27 UTC (rev 12128)
+++ csw/mgar/gar/v2/lib/python/models.py 2010-12-30 02:48:58 UTC (rev 12129)
@@ -120,6 +120,16 @@
files = sqlobject.MultipleJoin('CswFile',
joinColumn='id')
+ def DeleteAllDependentObjects(self):
+ data_obj = self.data_obj
+ self.data_obj = None
+ if data_obj:
+ # It could be already missing
+ data_obj.destroySelf()
+ self.RemoveAllCswFiles()
+ self.RemoveAllCheckpkgResults()
+ self.RemoveOverrides()
+
def RemoveAllCswFiles(self):
# Removing existing files, using sqlbuilder to use sql-level
# mechanisms without interacting with Python.
@@ -152,7 +162,21 @@
CheckpkgErrorTag.q.arch==arch,
CheckpkgErrorTag.q.catrel==catrel))))
+ def RemoveAllCheckpkgResults(self):
+ logging.debug("%s: RemoveAllCheckpkgResults()", self)
+ sqlobject.sqlhub.processConnection.query(
+ sqlobject.sqlhub.processConnection.sqlrepr(sqlbuilder.Delete(
+ CheckpkgErrorTag.sqlmeta.table,
+ CheckpkgErrorTag.q.srv4_file==self)))
+ def RemoveOverrides(self):
+ logging.debug("%s: RemoveOverrides()", self)
+ sqlobject.sqlhub.processConnection.query(
+ sqlobject.sqlhub.processConnection.sqlrepr(sqlbuilder.Delete(
+ CheckpkgOverride.sqlmeta.table,
+ CheckpkgOverride.q.srv4_file==self)))
+
+
class CheckpkgErrorTagMixin(object):
def ToGarSyntax(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list