From 03778c3e569ba0406bb40a36bcc9d5b964f6b7d7 Mon Sep 17 00:00:00 2001 From: Ramakrishna Date: Tue, 29 Aug 2023 18:05:35 +0530 Subject: [PATCH] Use dates library instead of datetime --- portality/tasks/preservation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/portality/tasks/preservation.py b/portality/tasks/preservation.py index a806174c16..47e82107e7 100644 --- a/portality/tasks/preservation.py +++ b/portality/tasks/preservation.py @@ -5,7 +5,6 @@ import shutil import tarfile from copy import deepcopy -from datetime import datetime from zipfile import ZipFile import requests @@ -209,7 +208,7 @@ def prepare(cls, username, **kwargs): :return: background job """ - created_time = dates.format(datetime.utcnow(), "%Y-%m-%d-%H-%M-%S") + created_time = dates.now() dir_name = username + "-" + created_time local_dir = os.path.join(Preservation.UPLOAD_DIR, dir_name) file = kwargs.get("upload_file") @@ -727,7 +726,7 @@ def __init__(self, preservation_dir, journal_dir, owner): self.preservation_dir = preservation_dir self.journal_dir = journal_dir self.package_dir = os.path.join(self.preservation_dir, journal_dir) - self.created_time = dates.format(datetime.utcnow(), "%Y-%m-%d-%H-%M-%S") + self.created_time = dates.now() self.tar_file = self.package_dir + "_" + self.created_time + ".tar.gz" self.tar_file_name = os.path.basename(self.tar_file) self.__owner = owner