def load_node(self, filename): filename = os.path.realpath(filename) if not filename.startswith(self.path): raise SecurityAccessException(filename) if not self.loader.supports(filename): return None node = self.loader.load(filename) if not node: return None node['id'] = self.get_id_from_path(filename) node['uuid'] = get_uuid(node['id']) node['path'] = node['id'] return node
def test_save_and_delete(self): uuid = get_uuid('tmp/simple_save') self.assertFalse(self.fs.delete(uuid)) self.assertTrue(self.fs.save(uuid, {'hello': 'world', 'type': 'mytype', 'path': 'tmp/simple_save'})) self.assertTrue(self.fs.delete(uuid))
def add_reference(self, path): fid = self.get_id_from_path(path) self.files[get_uuid(fid)] = fid