ensure INSTANCE_HOME is correct in all use cases

This commit is contained in:
Emmanuel Viennet 2021-02-15 15:08:53 +01:00
parent 44b757f447
commit 203c869638
1 changed files with 7 additions and 0 deletions

7
config/scodocutils.py Normal file → Executable file
View File

@ -9,6 +9,12 @@ import sys, os, psycopg2, glob, subprocess, traceback, time
sys.path.append("..")
# INSTANCE_HOME est nécessaire pour sco_utils.py
# note: avec le python 2.7 de Zope2, l'import de pyscopg2 change
# INSTANCE_HOME dans l'environnement !
# Ici on le fixe à la "bonne" valeur pour ScoDoc7.
os.environ["INSTANCE_HOME"] = "/opt/scodoc"
def log(msg):
sys.stdout.flush()
@ -26,6 +32,7 @@ if not SCODOC_VAR_DIR:
sys.exit(1)
SCODOC_LOGOS_DIR = os.environ.get("SCODOC_LOGOS_DIR", "")
def get_dept_cnx_str(dept):
"db cnx string for dept"
f = os.path.join(SCODOC_VAR_DIR, "config", "depts", dept + ".cfg")