[SCM] morituri/master: since the cached results have wrong (negative) relative for index > 01, make sure we don't use the cache by upping the version

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:10:13 UTC 2014


The following commit has been merged in the master branch:
commit abc03e8e433dc3327c65882b6a3e20b9032c73c8
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sat Aug 24 01:25:06 2013 +0200

    since the cached results have wrong (negative) relative for index > 01,
    make sure we don't use the cache by upping the version

diff --git a/morituri/common/cache.py b/morituri/common/cache.py
index b1cdb06..d2ff9fe 100644
--- a/morituri/common/cache.py
+++ b/morituri/common/cache.py
@@ -115,7 +115,7 @@ class Persister(log.Loggable):
         os.unlink(self._path)
 
 
-class PersistedCache(object):
+class PersistedCache(log.Loggable):
     """
     I wrap a directory of persisted objects.
     """
@@ -138,11 +138,15 @@ class PersistedCache(object):
         Returns the persister for the given key.
         """
         persister = Persister(self._getPath(key))
+        if persister.object:
+            if hasattr(persister.object, 'instanceVersion'):
+                o = persister.object
+                if o.instanceVersion < o.__class__.classVersion:
+                    self.debug(
+                        'key %r persisted object version %d is outdated',
+                        key, o.instanceVersion)
+                    persister.object = None
         # FIXME: don't delete old objects atm
-        # if persister.object:
-        #     if hasattr(persister.object, 'instanceVersion'):
-        #         o = persister.object
-        #         if o.instanceVersion < o.__class__.classVersion:
         #             persister.delete()
 
         return persister
@@ -230,6 +234,9 @@ class TableCache(log.Loggable):
                         self.debug('cached table is for different mb id %r' % (
                             ptable.object.getMusicBrainzDiscId()))
                     ptable.object = None
+                else:
+                    self.debug('no valid cached table found for %r' %
+                        cddbdiscid)
 
         if not ptable.object:
             # get an empty persistable from the writable location
diff --git a/morituri/image/table.py b/morituri/image/table.py
index 79d1422..56e33c5 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -168,7 +168,7 @@ class Table(object, log.Loggable):
     catalog = None # catalog number; FIXME: is this UPC ?
     cdtext = None
 
-    classVersion = 3
+    classVersion = 4
 
     def __init__(self, tracks=None):
         if not tracks:

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list