configurationengine/source/cone/storage/filestorage.py
changeset 5 d2c80f5cab53
parent 3 e7e0ae78773e
equal deleted inserted replaced
4:0951727b8815 5:d2c80f5cab53
   222                 # Optimization for direct file to ZIP export.
   222                 # Optimization for direct file to ZIP export.
   223                 # There's no need to juggle the data through ConE code
   223                 # There's no need to juggle the data through ConE code
   224                 # when we can just write the file directly into the ZIP
   224                 # when we can just write the file directly into the ZIP
   225                 if isinstance(storage, zipstorage.ZipStorage):
   225                 if isinstance(storage, zipstorage.ZipStorage):
   226                     source_abspath = os.path.join(self.rootpath, path)
   226                     source_abspath = os.path.join(self.rootpath, path)
   227                     logging.getLogger("cone").debug("Exporting directly from file to ZIP: %r -> %r" % (source_abspath, path))
   227                     logging.getLogger("cone").debug("Pre-caching: %r -> %r" % (source_abspath, path))
   228                     storage.zipfile.write(source_abspath, path)
   228                     storage.cache[path] = source_abspath
       
   229                     storage.modified = True
   229                 else:
   230                 else:
   230                     wres = storage.open_resource(path,'wb')
   231                     wres = storage.open_resource(path,'wb')
   231                     res  = self.open_resource(path,"rb")
   232                     res  = self.open_resource(path,"rb")
   232                     wres.write(res.read())
   233                     wres.write(res.read())
   233                     wres.close()
   234                     wres.close()