diff --git a/shared.py b/shared.py index a20c477..3e94ad6 100644 --- a/shared.py +++ b/shared.py @@ -1,4 +1,5 @@ import socket +import os hostname = socket.gethostname() PROD_HOST="pa_web" @@ -27,3 +28,16 @@ def CreateSelect(name, selected, list, js=""): str += f'>{el}' str += '' return str + +def SymlinkName(path, file): + sig_bit=file.replace(path, "") + last_dir=os.path.basename(path[0:-1]) + + if sig_bit[-1] == '/': + last_bit = os.path.dirname(sig_bit)[0:-1] + else: + last_bit = os.path.dirname(sig_bit) + symlink = 'static/'+last_dir+'/'+last_bit + if symlink[-1] == '/': + symlink=symlink[0:-1] + return symlink