diff --git a/gestion/secours.py b/gestion/secours.py index 084a799e..32fbb53c 100755 --- a/gestion/secours.py +++ b/gestion/secours.py @@ -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