Skip to content

Commit

Permalink
debug file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
helrond committed May 4, 2020
1 parent caee974 commit 479d082
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sip_assembly/routines_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
def copy_to_directory(sip, dest):
"""Moves a bag to the `dest` directory and updates the object's bag_path."""
dest_path = os.path.join(dest, "{}.tar.gz".format(sip.bag_identifier))
file_helpers.copy_file_or_dir(sip.bag_path, dest_path)
sip.bag_path = dest_path
sip.save()
copied = file_helpers.copy_file_or_dir(sip.bag_path, dest_path)
if copied:
sip.bag_path = dest_path
sip.save()


def move_to_directory(sip, dest):
"""Moves a bag to the `dest` directory and updates the object's bag_path"""
dest_path = os.path.join(dest, "{}.tar.gz".format(sip.bag_identifier))
file_helpers.move_file_or_dir(sip.bag_path, dest_path)
sip.bag_path = os.path.join(dest_path)
sip.save()
moved = file_helpers.move_file_or_dir(sip.bag_path, dest_path)
if moved:
sip.bag_path = os.path.join(dest_path)
sip.save()


def extract_all(sip, extract_dir):
Expand Down

0 comments on commit 479d082

Please sign in to comment.