Modifs pour permettre de mettre la balise sur la ligne prcdente
darcs-hash:20041009085743-d1718-0816c63b5be5206e755e6cbd8ab74aba6a1fce64.gz
This commit is contained in:
parent
1d5bafbbbe
commit
15b9a55a40
1 changed files with 8 additions and 1 deletions
|
@ -17,9 +17,11 @@ def edit(file,comment,secours) :
|
|||
fd = open(file)
|
||||
line = fd.readline()
|
||||
new = ''
|
||||
nextone = False # La prochaine ligne est-elle a triter ? non
|
||||
while line :
|
||||
l = line.rstrip()
|
||||
if sre.match('.*'+signal+'$',l) :
|
||||
mo = sre.match('^(.*)'+signal+'$',l)
|
||||
if (mo and len(mo.group(1)) > 1) or nextone:
|
||||
# Ligne pour secours
|
||||
if not sre.match('^' + comment,l) and not secours:
|
||||
# On est actuellement configuré en secours
|
||||
|
@ -32,6 +34,11 @@ def edit(file,comment,secours) :
|
|||
else :
|
||||
# Rien à faire, on est bien configuré
|
||||
new += line
|
||||
elif mo and len(mo.group(1)) == 0:
|
||||
# On a une ligne avec secours uniquement, c'est la prochaine ligne
|
||||
# qui fait foi
|
||||
nextone = True
|
||||
new += line
|
||||
else :
|
||||
# Ligne normale
|
||||
new += line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue