prise en compte du ~/.dialogrc
This commit is contained in:
parent
ef95c2b159
commit
b88ba2a34f
2 changed files with 12 additions and 3 deletions
|
@ -203,7 +203,7 @@ class Dialog(object):
|
||||||
setattr(self, attr, ret)
|
setattr(self, attr, ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def __init__(self, debug_enable=False):
|
def __init__(self, debug_enable=False, dialogrc=False):
|
||||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
|
||||||
self.debug_enable = debug_enable
|
self.debug_enable = debug_enable
|
||||||
|
@ -211,6 +211,7 @@ class Dialog(object):
|
||||||
# On met un timeout à 10min d'innactivité sur dialog
|
# On met un timeout à 10min d'innactivité sur dialog
|
||||||
self.timeout = 600
|
self.timeout = 600
|
||||||
self.error_to_raise = (Continue, DialogError, ldap.SERVER_DOWN)
|
self.error_to_raise = (Continue, DialogError, ldap.SERVER_DOWN)
|
||||||
|
self.dialogrc = dialogrc
|
||||||
|
|
||||||
_dialog = None
|
_dialog = None
|
||||||
@property
|
@property
|
||||||
|
@ -218,7 +219,9 @@ class Dialog(object):
|
||||||
"""
|
"""
|
||||||
Renvois l'objet dialog.
|
Renvois l'objet dialog.
|
||||||
"""
|
"""
|
||||||
if self._dialog is None:
|
if self.dialogrc:
|
||||||
|
self._dialog = PythonDialog(DIALOGRC=self.dialogrc)
|
||||||
|
else:
|
||||||
self._dialog = PythonDialog()
|
self._dialog = PythonDialog()
|
||||||
self.dialog_last_access = time.time()
|
self.dialog_last_access = time.time()
|
||||||
return self._dialog
|
return self._dialog
|
||||||
|
|
|
@ -6,6 +6,7 @@ Copyright (C) Valentin Samir
|
||||||
Licence : GPLv3
|
Licence : GPLv3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import ldap
|
import ldap
|
||||||
|
@ -27,7 +28,12 @@ from CPS import TailCall, tailcaller, Continue, TailCaller
|
||||||
|
|
||||||
class Dialog(CPS.Dialog):
|
class Dialog(CPS.Dialog):
|
||||||
def __init__(self, debug_enable=False, ldap_test=False, custom_user=None):
|
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
|
# On initialise le moteur de rendu en spécifiant qu'on va faire du dialog
|
||||||
printing.template(dialog=True)
|
printing.template(dialog=True)
|
||||||
self.ldap_test = ldap_test
|
self.ldap_test = ldap_test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue