import socket import os hostname = socket.gethostname() PROD_HOST="pa_web" ICON={} ICON["Import"]="fa-file-upload" ICON["Storage"]="fa-database" ICON["Bin"]="fa-trash-alt" if hostname == "lappy": PA_JOB_MANAGER_HOST="localhost" DB_URL = 'postgresql+psycopg2://pa:for_now_pa@localhost:5432/pa' elif os.environ['FLASK_ENV'] == "development": PA_JOB_MANAGER_HOST="localhost" DB_URL = 'postgresql+psycopg2://pa:for_now_pa@mara.ddp.net:65432/pa' elif os.environ['FLASK_ENV'] == "production": PA_JOB_MANAGER_HOST="192.168.0.2" DB_URL = 'postgresql+psycopg2://pa:for_now_pa@padb/pa' else: print( "ERROR: I do not know which environment (development, etc.) and which DB (on which host to use)" ) exit( -1 ) PA_JOB_MANAGER_PORT=55430 THUMBSIZE=256 def CreateSelect(name, selected, list, js=""): str = f'' return str def CreateFoldersSelect(selected): str = f'' return str def LocationIcon(obj): return ICON[obj.in_dir.in_path.type.name] # translate a path type, a full FS path and a file into the full FS path of the # symlink on the file system. To note, this is used with file == path, when we # want to just get the symlink to the path itself, otherwise file == ### FIXME: I think this is way over-complicated, want to revist one day, with #what params are passed in, what we need to get out -- I think the overloaded #file/oath use case, and why sometimes we trail with a / or not and then concat #last_dir and bit before last_dir, etc. this feels a bit too complicated for #what it does OR we comment this much better def SymlinkName(ptype, path, file): sig_bit=file.replace(path, "") last_dir=os.path.basename(path[0:-1]) if len(sig_bit) > 0 and sig_bit[-1] == '/': last_bit = os.path.dirname(sig_bit)[0:-1] else: last_bit = os.path.dirname(sig_bit) symlink = 'static/'+ptype+'/'+last_dir+'/'+last_bit if symlink[-1] == '/': symlink=symlink[0:-1] return symlink