def _open_read(self, image_meta, mode): image_id = image_meta['id'] path = self.path_for_image(image_id) with open(path, mode) as cache_file: yield cache_file utils.inc_xattr(path, 'hits') # bump the hit count
def open_for_read(self, image_id): path = self.path_for_image(image_id) with open(path, 'rb') as cache_file: yield cache_file utils.inc_xattr(path, 'hits') # bump the hit count