Example #1
0
 def extract(self):
     """
     Will make all the directories and expand the files.
     Raises error on nasty files.
     """
     try:
         tempdir = extract_zip(self.src)
         # Move extracted files into persistent storage.
         for root, subdirs, files in os.walk(tempdir):
             storage_root = root.replace(tempdir, self.dest, 1)
             for fname in files:
                 file_src = os.path.join(root, fname)
                 file_dest = os.path.join(storage_root, fname)
                 copyfileobj(open(file_src), storage.open(file_dest, 'w'))
     except Exception, err:
         task_log.error('Error (%s) extracting %s' % (err, self.src))
         raise
Example #2
0
 def extract(self):
     """
     Will make all the directories and expand the files.
     Raises error on nasty files.
     """
     try:
         tempdir = extract_zip(self.src)
         # Move extracted files into persistent storage.
         for root, subdirs, files in os.walk(tempdir):
             storage_root = root.replace(tempdir, self.dest, 1)
             for fname in files:
                 file_src = os.path.join(root, fname)
                 file_dest = os.path.join(storage_root, fname)
                 with open(file_src) as local_f:
                     with storage.open(file_dest, 'w') as remote_f:
                         copyfileobj(local_f, remote_f)
     except Exception, err:
         task_log.error('Error (%s) extracting %s' % (err, self.src))
         raise
Example #3
0
 def extract(self):
     """
     Will make all the directories and expand the files.
     Raises error on nasty files.
     """
     if self.file.status in mkt.LISTED_STATUSES:
         storage = public_storage
     else:
         storage = private_storage
     try:
         tempdir = extract_zip(storage.open(self.src))
         # Move extracted files into persistent storage.
         for root, subdirs, files in os.walk(tempdir):
             storage_root = root.replace(tempdir, self.dest, 1)
             for fname in files:
                 file_src = os.path.join(root, fname)
                 file_dest = os.path.join(storage_root, fname)
                 copy_stored_file(file_src, file_dest,
                                  src_storage=local_storage,
                                  dst_storage=private_storage)
     except Exception, err:
         task_log.error('Error (%s) extracting %s' % (err, self.src))
         raise
Example #4
0
 def extract(self):
     """
     Will make all the directories and expand the files.
     Raises error on nasty files.
     """
     if self.file.status in mkt.LISTED_STATUSES:
         storage = public_storage
     else:
         storage = private_storage
     try:
         tempdir = extract_zip(storage.open(self.src))
         # Move extracted files into persistent storage.
         for root, subdirs, files in os.walk(tempdir):
             storage_root = root.replace(tempdir, self.dest, 1)
             for fname in files:
                 file_src = os.path.join(root, fname)
                 file_dest = os.path.join(storage_root, fname)
                 copy_stored_file(file_src,
                                  file_dest,
                                  src_storage=local_storage,
                                  dst_storage=private_storage)
     except Exception, err:
         task_log.error('Error (%s) extracting %s' % (err, self.src))
         raise