#5707 BLOC Update.: Previews are not deleted when their matching datastore objects are removed
Zarro Boogs per Child
bugtracker at laptop.org
Wed Jan 2 12:07:01 EST 2008
#5707: Previews are not deleted when their matching datastore objects are removed
------------------------+---------------------------------------------------
Reporter: Phil | Owner: tomeu
Type: defect | Status: new
Priority: blocker | Milestone: Update.1
Component: datastore | Version: Build 650
Resolution: | Keywords: review?
Verified: 0 | Blocking:
Blockedby: |
------------------------+---------------------------------------------------
Changes (by tomeu):
* cc: marco (added)
* keywords: => review?
Comment:
This patch will delete previews along with the object:
{{{
diff --git a/src/olpc/datastore/backingstore.py
b/src/olpc/datastore/backingstore.py
index e900649..284cb0c 100644
--- a/src/olpc/datastore/backingstore.py
+++ b/src/olpc/datastore/backingstore.py
@@ -601,6 +601,14 @@ class FileBackingStore(BackingStore):
self.indexmanager.index(props)
def delete(self, uid, allowMissing=True):
+ # HACK: delete the preview file if any.
+ # Generic support for external properties is not needed as a
rewrite of
+ # the datastore is scheduled before more external properties are
added
+ # to the model.
+ pfile = os.path.join(self.base, 'preview', uid)
+ if os.path.exists(pfile):
+ os.unlink(pfile)
+
self.indexmanager.delete(uid)
path = self._translatePath(uid)
if os.path.exists(path):
@@ -889,6 +897,14 @@ class InplaceFileBackingStore(FileBackingStore):
self.indexmanager.index(props, path)
def delete(self, uid):
+ # HACK: delete the preview file if any.
+ # Generic support for external properties is not needed as a
rewrite of
+ # the datastore is scheduled before more external properties are
added
+ # to the model.
+ pfile = os.path.join(self.base, 'preview', uid)
+ if os.path.exists(pfile):
+ os.unlink(pfile)
+
c = self.indexmanager.get(uid)
path = c.get_property('filename', None)
self.indexmanager.delete(uid)
}}}
--
Ticket URL: <http://dev.laptop.org/ticket/5707#comment:5>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system
More information about the Bugs
mailing list