From c1d903848e6e1a0db96f62cc59d6eaa203bf89b3 Mon Sep 17 00:00:00 2001 From: Sinisa Veseli <sveseli@aps.anl.gov> Date: Mon, 8 Feb 2016 05:31:44 +0000 Subject: [PATCH] get files as stat dictionary --- src/python/dm/common/utility/osUtility.py | 8 +++++++- .../service/impl/experimentSessionControllerImpl.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/python/dm/common/utility/osUtility.py b/src/python/dm/common/utility/osUtility.py index 09c0bd4e..0f977d8d 100755 --- a/src/python/dm/common/utility/osUtility.py +++ b/src/python/dm/common/utility/osUtility.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +import stat class OsUtility: @@ -117,7 +118,12 @@ class OsUtility: for f in files: fullPath = os.path.join(dirPath, f) if os.path.isfile(fullPath): - fDict[fullPath] = os.stat(fullPath) + statResult = os.stat(fullPath) + fileInfo = {} + fileInfo['fileSize'] = statResult[stat.ST_SIZE] + fileInfo['fileCreationTime'] = statResult[stat.ST_CTIME] + fileInfo['fileModificationTime'] = statResult[stat.ST_MTIME] + fDict[fullPath] = fileInfo elif os.path.isdir(fullPath): fDict = cls.findFilesAsDict(fullPath, fDict) return fDict diff --git a/src/python/dm/daq_web_service/service/impl/experimentSessionControllerImpl.py b/src/python/dm/daq_web_service/service/impl/experimentSessionControllerImpl.py index 651e5bed..a2f1abc8 100755 --- a/src/python/dm/daq_web_service/service/impl/experimentSessionControllerImpl.py +++ b/src/python/dm/daq_web_service/service/impl/experimentSessionControllerImpl.py @@ -96,6 +96,7 @@ class ExperimentSessionControllerImpl(DmObjectManager): filePathsDict = fileProcessingManager.removeHiddenFilesFromProcessing(filePathsDict, uploadInfo) # Check which files need to be processed filePathsDict = fileProcessingManager.checkUploadFilesForProcessing(filePathsDict, uploadInfo) + print "FILEPATHSDICT: ", filePathsDict if not len(filePathsDict): raise InvalidRequest('There are no new files for upload in directory %s.' % dataDirectory) -- GitLab