[SCM] morituri/master: * morituri/common/cache.py: Disable the version-based persistence deleting. Allow not creating a fresh ripresult when getting one.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:48 UTC 2014


The following commit has been merged in the master branch:
commit 67540627fa90abe8ed5fbec4af8c72aa7fc04fbc
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Dec 2 17:53:47 2012 +0000

    	* morituri/common/cache.py:
    	  Disable the version-based persistence deleting.
    	  Allow not creating a fresh ripresult when getting one.

diff --git a/ChangeLog b/ChangeLog
index 7768ce1..3496bff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2012-12-02  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/cache.py:
+	  Disable the version-based persistence deleting.
+	  Allow not creating a fresh ripresult when getting one.
+
+2012-12-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/cache.py:
 	* morituri/rip/debug.py:
 	* morituri/test/test_common_cache.py:
 	  Add rip debug resultcache list to list cached results.
diff --git a/morituri/common/cache.py b/morituri/common/cache.py
index f0147bf..45c265f 100644
--- a/morituri/common/cache.py
+++ b/morituri/common/cache.py
@@ -137,8 +137,8 @@ class PersistedCache(object):
         if persister.object:
             if hasattr(persister.object, 'instanceVersion'):
                 o = persister.object
-                if o.instanceVersion < o.__class__.classVersion:
-                    persister.delete()
+                # if o.instanceVersion < o.__class__.classVersion:
+                #     persister.delete()
 
         return persister
 
@@ -157,7 +157,7 @@ class ResultCache(log.Loggable):
             'result')
         return path
 
-    def getRipResult(self, cddbdiscid):
+    def getRipResult(self, cddbdiscid, create=True):
         """
         Retrieve the persistable RipResult either from our cache (from a
         previous, possibly aborted rip), or return a new one.
@@ -167,10 +167,14 @@ class ResultCache(log.Loggable):
         presult = self._pcache.get(cddbdiscid)
 
         if not presult.object:
-            self.debug('result for cddbdiscid %r not in cache, creating',
-                cddbdiscid)
+            self.debug('result for cddbdiscid %r not in cache', cddbdiscid)
+            if not create:
+                self.debug('returning None')
+                return None
+
+            self.debug('creating result')
             presult.object = result.RipResult()
-            presult.persist(self.result)
+            presult.persist(presult.object)
         else:
             self.debug('result for cddbdiscid %r found in cache, reusing',
                 cddbdiscid)

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list