Commit 00f50d85 authored by Caillat Michel's avatar Caillat Michel
Browse files

FITS toplevel dir is now found in env var YAFITS_FITSDIR and is capable of...

FITS toplevel dir is now found in env var YAFITS_FITSDIR and is capable of processing symbolic links to directories
parent 7ad552fb
......@@ -15,8 +15,9 @@ from datetime import datetime
from DataBlock import DataBlock
DataRoot = "dataroot"
FITSFilePrefix = DataRoot + '/FITS/'
FITSFilePrefix = os.getenv("YAFITS_FITSDIR")
DataRoot = "/home/partemix/dataroot"
PNGFilePrefix = DataRoot + '/PNG/'
OBJFilePrefix = DataRoot + '/OBJ/'
ApiDocPrefix = DataRoot + '/apidoc/'
......@@ -62,14 +63,21 @@ class DataManagerImpl :
try :
absFITSFilePrefix = FITSFilePrefix + relKey
entries = (os.listdir(absFITSFilePrefix))
self.__logger.debug("type of entries %s" % (type(entries)))
self.__logger.debug("%r" % entries)
sortedEntries = entries.sort()
children = []
for entry in entries:
p = absFITSFilePrefix + '/' + entry
condition = os.path.isfile(p) and p.endswith(".fits")
condition = condition or (os.path.islink(p) and os.path.isdir(os.readlink(p)))
condition = condition or (os.path.isdir(p))
condition = (os.path.isfile(p) and p.endswith(".fits"))
if not condition :
self.__logger.debug("%s link %r" % (p, os.path.islink(p)))
if os.path.islink(p):
target = os.path.realpath(p)
self.__logger.debug("%s is dir %r" %(target, os.path.isdir(target)))
condition = os.path.islink(p) # and os.path.isdir(target)
else :
condition = (os.path.isdir(p))
if not condition :
continue
elif entry in ["log", "NOFITS", "IGNORE"]:
......@@ -89,6 +97,7 @@ class DataManagerImpl :
except Exception as e :
result = {"status": False, "message": "Problem while looking for entries under '%s'. Error message was '%s'" % ( relKey, e)}
self.__logger.debug("%r" % result)
self.__logger.debug("%r" % result)
self.__logger.debug("__getEntries_0: exiting")
return result
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment