def open_file(self, name, mode=u'r'): path = self._topath(name) uf = self.fs.open(path, mode=mode) if mode == u'w': uf.content_type = 'application/structfile' uf.force_rev = 0 sf = StructFile(uf) sf.is_real = False sf.fileno = None return sf
def create_file(self, name, excl=False, mode="w+b", **kwargs): f = StructFile(io.BytesIO(), name=name, onclose=self._encrypt_index_on_close(name)) f.is_real = False return f