diff options
author | jortel <devnull@localhost> | 2010-03-31 16:38:46 +0000 |
---|---|---|
committer | jortel <devnull@localhost> | 2010-03-31 16:38:46 +0000 |
commit | 59eb5d49b1ff0c770829ae4c5f2ae637a5fd4e43 (patch) | |
tree | 3239d05ad274c7e29307703f20b6e0817b76c6f7 /suds | |
parent | 245384074da49f25c536f2f2950b66dc5681c3b0 (diff) | |
download | suds-59eb5d49b1ff0c770829ae4c5f2ae637a5fd4e43.tar.gz |
Add version checking to ensure that the cache is cleared when suds is upgraded.
Diffstat (limited to 'suds')
-rw-r--r-- | suds/cache.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/suds/cache.py b/suds/cache.py index c2bd624..8fa9b21 100644 --- a/suds/cache.py +++ b/suds/cache.py @@ -19,6 +19,7 @@ Contains basic caching classes. """ import os +import suds from tempfile import gettempdir as tmp from suds.transport import * from suds.sax.parser import Parser @@ -141,6 +142,7 @@ class FileCache(Cache): self.location = location self.duration = (None, 0) self.setduration(**duration) + self.checkversion() def fnsuffix(self): """ @@ -261,6 +263,21 @@ class FileCache(Cache): self.mktmp() return open(fn, *args) + def checkversion(self): + path = os.path.join(self.location, 'version') + try: + + f = open(path) + version = f.read() + f.close() + if version != suds.__version__: + raise Exception() + except: + self.clear() + f = open(path, 'w') + f.write(suds.__version__) + f.close() + def __fn(self, id): name = id suffix = self.fnsuffix() |