[kupfer] data: Simply check equality to test unpickled cached source



commit 7e1db38a893f46abb2e664d708dcf1cd96f63b0f
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Aug 20 23:36:14 2009 +0200

    data: Simply check equality to test unpickled cached source
    
    A simple equality check should be enough, let's use this abstraction
    in the data module.

 kupfer/data.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/data.py b/kupfer/data.py
index 1cf158b..dfc6728 100644
--- a/kupfer/data.py
+++ b/kupfer/data.py
@@ -281,13 +281,10 @@ class SourcePickler (pretty.OutputMixin):
 			return None
 
 		# check consistency
-		if (type(source) == type(cached) and
-			(hasattr(source, "version") == hasattr(cached, "version") and
-			source.version == cached.version)):
+		if source == cached:
 			return cached
 		else:
-			self.output_debug("Source version changed to %s %s" %
-					(source, source.version))
+			self.output_debug("Cached version mismatches", source)
 		return None
 	def _unpickle_source(self, pickle_file):
 		try:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]