prise en compte du ~/.dialogrc

This commit is contained in:
Daniel STAN 2015-11-10 20:38:47 +01:00
parent ef95c2b159
commit b88ba2a34f
2 changed files with 12 additions and 3 deletions

View file

@ -203,7 +203,7 @@ class Dialog(object):
setattr(self, attr, ret)
return ret
def __init__(self, debug_enable=False):
def __init__(self, debug_enable=False, dialogrc=False):
signal.signal(signal.SIGINT, signal.SIG_IGN)
self.debug_enable = debug_enable
@ -211,6 +211,7 @@ class Dialog(object):
# On met un timeout à 10min d'innactivité sur dialog
self.timeout = 600
self.error_to_raise = (Continue, DialogError, ldap.SERVER_DOWN)
self.dialogrc = dialogrc
_dialog = None
@property
@ -218,7 +219,9 @@ class Dialog(object):
"""
Renvois l'objet dialog.
"""
if self._dialog is None:
if self.dialogrc:
self._dialog = PythonDialog(DIALOGRC=self.dialogrc)
else:
self._dialog = PythonDialog()
self.dialog_last_access = time.time()
return self._dialog

View file

@ -6,6 +6,7 @@ Copyright (C) Valentin Samir
Licence : GPLv3
"""
import os
import sys
import time
import ldap
@ -27,7 +28,12 @@ from CPS import TailCall, tailcaller, Continue, TailCaller
class Dialog(CPS.Dialog):
def __init__(self, debug_enable=False, ldap_test=False, custom_user=None):
super(Dialog, self).__init__(debug_enable=debug_enable)
# if os.path.exists(os.path.expanduser('~/.dialogrc')):
if True:
dialogrc='~/.dialogrc'
else:
dialogrc=False
super(Dialog, self).__init__(debug_enable=debug_enable, dialogrc=dialogrc)
# On initialise le moteur de rendu en spécifiant qu'on va faire du dialog
printing.template(dialog=True)
self.ldap_test = ldap_test