diff --git a/gestion/ajoute_chambre.py b/gestion/ajoute_chambre.py index 206d7546..fcb7c4c2 100755 --- a/gestion/ajoute_chambre.py +++ b/gestion/ajoute_chambre.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # -*- coding: iso-8859-15 -*- # -# $Id: ajoute_chambre.py,v 1.1 2007-02-24 00:51:29 dimino Exp $ +# $Id: ajoute_chambre.py,v 1.2 2007-02-24 01:08:45 dimino Exp $ # # ajoute_chambre.py # ----------------- @@ -81,8 +81,6 @@ prise doit tampon = annuaire.read() annuaire.close() - annuaire = open(__fichier_annuaire, 'w') - # Du parsing chiant... index = tampon.find('\nchbre_prises') if index == -1 or tampon[index + 13] not in [ ' ', '=' ]: @@ -94,11 +92,16 @@ prise doit index = tampon.find("'XXX':'%s'" % (prise), index + 3) if index == -1: - return 'prise_introuvable' + prise += '-' + index = tampon.find("'XXX':'%s'" % (prise), index + 3) + if index == -1: + return 'prise_introuvable' + + annuaire = open(__fichier_annuaire, 'w') annuaire.write(tampon[:index]) annuaire.write("'%s':'%s'" % (chbre, prise)) - annuaire.write(tampon[(index+11):]) + annuaire.write(tampon[(index+8+len(prise)):]) annuaire.close() @@ -113,7 +116,7 @@ prise doit user = "(uid=%d)" % (os.getuid()) break - os.system('/usr/bin/cvs commit -d /usr/scripts/gestion %s \ + os.system('cd /usr/scripts/gestion && /usr/bin/cvs commit %s \ -m "ajoute_chambre.py: chambre %s%s ajouté sur la prise %s%s par %s"' % (__fichier_annuaire, bat, chbre, bat, prise, user))