[digicode.py] fonctionnement sur asterisk

This commit is contained in:
Daniel STAN 2013-06-20 17:34:31 +02:00
parent 5253e7340c
commit c8cee16a97

View file

@ -37,8 +37,8 @@ import cranslib.utils.files
# #############################################################
# CONSTANTES
# #############################################################
CODES_SERVER = "zamok"
CODES_DIR = "/var/impression/codes/"
CODES_SERVERS = ["zamok", "asterisk"]
CODES_DIR = "/usr/scripts/var/digicode/"
# #############################################################
@ -52,10 +52,11 @@ def CodeAlreadyExists(Exception):
# #############################################################
# test pour voir si on est bien sur la bonne machine
import socket
if socket.gethostname() != CODES_SERVER:
if socket.gethostname() not in CODES_SERVERS:
CODES_DIR = tempfile.mkdtemp(prefix='fake_digicode')
FAKE_DIR = True
#raise EnvironmentError, "La manipulation des codes pour le digicode n'est possible que sur %s" % CODES_SERVER
raise EnvironmentError("La manipulation des codes pour le digicode n'est possible que sur %s" %
', '.join(CODES_SERVERS))
else:
FAKE_DIR = False