예제 #1
0
파일: fruit.py 프로젝트: pooingx2/Dripbox
    def get_contents_to_buf(self):
        #download file by using file name(string)
        #flow : download each cloud storage -> combine -> decryption -> save complete file -> flush tmp dir

        #download each cloud storage
        #download from s3
        combiner = file_mng(self.tmp_dir)
        tmp_dir = combiner.tmp_dir
        print "download to s3"
        self.s3_key.get_contents_to_filename(tmp_dir+"tmp1")
        print "download to ssg"
        self.ssg_key.get_contents_to_filename(tmp_dir+"tmp2")

        #combine files
        enc_buf = combiner.combine_tmp_files()
        #decryption(save complete file)
        dec = Encryption(self.tree.connection._cre.meta_pw)

        #decrpytion(filename)
        dec_buf = dec.decrypt(enc_buf)

        #flush tmp dir
        combiner.flush_tmp_dir()

        #error시엔 에러 메시지 출력 후 finally로 무조건 tmp dir 날리기
        return dec_buf