[secours/secours.py] sre is deprecated
darcs-hash:20090417113209-ddb99-a5f0e22662286a02253a5edc3ec60f1b0bd5f1dc.gz
This commit is contained in:
parent
cd0b2d626b
commit
6f2b871668
1 changed files with 4 additions and 4 deletions
|
@ -14,7 +14,7 @@
|
|||
Frédéric Pauget août 2005
|
||||
"""
|
||||
|
||||
import sys, sre, os, commands
|
||||
import sys, re, os, commands
|
||||
from socket import gethostname
|
||||
hostname = gethostname().split(".")[0]
|
||||
path = os.path.dirname(sys.argv[0])
|
||||
|
@ -74,14 +74,14 @@ def edit(file,comment,etat) :
|
|||
reste = 0 # Nombre de lignes restant à traiter
|
||||
while line :
|
||||
l = line.rstrip()
|
||||
mo = sre.match('^(.*)'+signal+'(|-.)$',l)
|
||||
mo = re.match('^(.*)'+signal+'(|-.)$',l)
|
||||
if (mo and len(mo.group(1)) > 1) or reste:
|
||||
# Ligne pour secours
|
||||
if not sre.match('^' + comment,l) and etat == 'normal':
|
||||
if not re.match('^' + comment,l) and etat == 'normal':
|
||||
# On est actuellement configuré en secours
|
||||
# Il faut passer en normal
|
||||
new += comment + line
|
||||
elif sre.match('^' + comment,l) and etat == 'secours' :
|
||||
elif re.match('^' + comment,l) and etat == 'secours' :
|
||||
# On est actuellement configuré en normal
|
||||
# Il faut passer en secours
|
||||
new += line.replace(comment,'',1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue