diff roundup/backends/blobfiles.py @ 3906:666b70676ec6

destroy blobfiles if they exist Fixes [SF#1654132]
author Justus Pendleton <jpend@users.sourceforge.net>
date Sun, 16 Sep 2007 06:51:48 +0000
parents e02cf6f9ae74
children 1dab48842cbd
line wrap: on
line diff
--- a/roundup/backends/blobfiles.py	Sun Sep 16 05:39:11 2007 +0000
+++ b/roundup/backends/blobfiles.py	Sun Sep 16 06:51:48 2007 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-#$Id: blobfiles.py,v 1.21 2007-09-12 16:15:40 jpend Exp $
+#$Id: blobfiles.py,v 1.22 2007-09-16 06:51:48 jpend Exp $
 '''This module exports file storage for roundup backends.
 Files are stored into a directory hierarchy.
 '''
@@ -163,4 +163,21 @@
             name += '.tmp'
         os.remove(name)
 
+    def isStoreFile(self, classname, nodeid):
+        '''See if there is actually any FileStorage for this node.
+           Is there a better way than using self.filename?
+        '''
+        try:
+            fname = self.filename(classname, nodeid)
+            return True
+        except IOError:
+            return False
+
+    def destroy(self, classname, nodeid):
+        '''If there is actually FileStorage for this node
+           remove it from the filesystem
+        '''
+        if self.isStoreFile(classname, nodeid):
+            os.remove(self.filename(classname, nodeid))
+
 # vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/