summaryrefslogtreecommitdiff
path: root/obnamlib/plugins/fuse_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-02-23 18:43:00 +0000
committerLars Wirzenius <liw@liw.fi>2014-02-23 18:43:00 +0000
commit68c280c5bf1cf8d6330280b188ed73c333dc9403 (patch)
treee9a25239917ecc5eaccee466135d5ff9a3e87658 /obnamlib/plugins/fuse_plugin.py
parent461014864c2bc07f2b5ab49606d6a081f1a56f28 (diff)
downloadobnam-68c280c5bf1cf8d6330280b188ed73c333dc9403.tar.gz
Simplify code
It's clearer to use "if foo in bar" rather than catching KeyError.
Diffstat (limited to 'obnamlib/plugins/fuse_plugin.py')
-rw-r--r--obnamlib/plugins/fuse_plugin.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/obnamlib/plugins/fuse_plugin.py b/obnamlib/plugins/fuse_plugin.py
index 05d12395..e6800f20 100644
--- a/obnamlib/plugins/fuse_plugin.py
+++ b/obnamlib/plugins/fuse_plugin.py
@@ -215,9 +215,8 @@ class ObnamFuse(fuse.Fuse):
def get_metadata(self, path):
tracing.trace('path=%r', path)
- try:
- return self.metadatacache[path]
- except KeyError:
+
+ if path not in self.metadatacache:
if len(self.metadatacache) > self.MAX_METADATA_CACHE:
self.metadatacache.clear()
metadata = self.obnam.repo.get_metadata(*self.get_gen_path(path))
@@ -227,7 +226,8 @@ class ObnamFuse(fuse.Fuse):
metadata.st_atime_sec = 0
if metadata.st_mtime_sec < 0:
metadata.st_mtime_sec = 0
- return metadata
+
+ return self.metadatacache[path]
def get_stat(self, path):
tracing.trace('path=%r', path)