summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-11-20 18:28:55 +0100
committerhut <hut@lavabit.com>2010-11-20 18:28:55 +0100
commitfe6e709f4ccff7e0fe8aa8e492b79396012c780c (patch)
treef79f2dc0bfa33dee2fe060368f619051fc8e48a0
parent11fd0fe982ee72b30e007645e82f6bdb278f1bb4 (diff)
downloadranger-fe6e709f4ccff7e0fe8aa8e492b79396012c780c.tar.gz
fsobject: The lazy lookup of .image attribute was *too* lazy
-rw-r--r--ranger/fsobject/fsobject.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 8468839d..f9b023d7 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -109,6 +109,10 @@ class FileSystemObject(FileManagerAware):
 		return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \
 			enumerate(_extract_number_re.split(self.basename_lower))]
 
+	for attr in ('video', 'audio', 'image', 'media', 'document', 'container'):
+		exec("%s = lazy_property("
+			"lambda self: self.set_mimetype() or self.%s)" % (attr, attr))
+
 	def __str__(self):
 		"""returns a string containing the absolute path"""
 		return str(self.path)
#n125'>125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172