Encore quelques espaces.
darcs-hash:20060321013208-68412-e50045a50db35a21153c648d35bd3c728c4586e7.gz
This commit is contained in:
parent
5bf2e284f9
commit
6eb26e3424
1 changed files with 20 additions and 20 deletions
|
@ -203,7 +203,7 @@ def format_mac(mac):
|
|||
|
||||
class service:
|
||||
""" Définit un service à redémarrer """
|
||||
def __init__(self, nom, args = [], start = []):
|
||||
def __init__(self, nom, args=[], start=[]):
|
||||
"""
|
||||
Nom du service
|
||||
Liste des arguments
|
||||
|
@ -256,7 +256,7 @@ class crans_ldap:
|
|||
|
||||
auto_search_champs = { \
|
||||
'adherent': \
|
||||
['nom', 'prenom', 'tel', 'mail', 'chbre', 'mailAlias', 'canonicalAlias' ],
|
||||
['nom', 'prenom', 'tel', 'mail', 'chbre', 'mailAlias', 'canonicalAlias'],
|
||||
'club': ['nom', 'chbre'],
|
||||
'machineFixe': auto_search_machines_champs,
|
||||
'machineWifi': auto_search_machines_champs,
|
||||
|
@ -913,7 +913,7 @@ class base_classes_crans(crans_ldap):
|
|||
else:
|
||||
index = -1
|
||||
|
||||
if type(new)!=list or len(new)!=4:
|
||||
if type(new) != list or len(new) != 4:
|
||||
raise TypeError
|
||||
|
||||
# Verif que les dates sont OK
|
||||
|
@ -927,7 +927,7 @@ class base_classes_crans(crans_ldap):
|
|||
if new[1] == 'now':
|
||||
new[1] = time.strftime(date_format)
|
||||
fin = 0
|
||||
elif new[1]!='-':
|
||||
elif new[1] != '-':
|
||||
try: fin = int(time.mktime(time.strptime(new[1], date_format)))
|
||||
except: raise ValueError(u'Date de fin blacklist invalide')
|
||||
else:
|
||||
|
@ -943,7 +943,7 @@ class base_classes_crans(crans_ldap):
|
|||
new_c = ','.join(new)
|
||||
new_c = preattr(new_c)[1]
|
||||
|
||||
if index!=-1:
|
||||
if index != -1:
|
||||
liste[index] = new_c
|
||||
else:
|
||||
liste = liste + [ new_c ]
|
||||
|
@ -958,7 +958,7 @@ class base_classes_crans(crans_ldap):
|
|||
else:
|
||||
if debut not in self._blacklist_restart[new[2]]:
|
||||
self._blacklist_restart[new[2]].append(debut)
|
||||
if fin!=-1 and fin not in self._blacklist_restart[new[2]]:
|
||||
if fin != -1 and fin not in self._blacklist_restart[new[2]]:
|
||||
self._blacklist_restart[new[2]].append(fin)
|
||||
|
||||
return liste
|
||||
|
@ -1185,7 +1185,7 @@ class base_classes_crans(crans_ldap):
|
|||
def _set(self, champ, val, comment=None):
|
||||
""" Met à jour les données de data et modifie modifs si besoin """
|
||||
if (not self._data.has_key(champ) and val != []) \
|
||||
or (self._data.has_key(champ) and self._data[champ]!=val):
|
||||
or (self._data.has_key(champ) and self._data[champ] != val):
|
||||
self._data[champ] = val
|
||||
if self.modifs.get(champ) == None or comment == None:
|
||||
self.modifs[champ] = comment
|
||||
|
@ -1286,7 +1286,7 @@ class base_proprietaire(base_classes_crans):
|
|||
if mailexist(new):
|
||||
raise ValueError(u"Alias existant ou correspondand à un compte.")
|
||||
|
||||
if index!=-1:
|
||||
if index != -1:
|
||||
liste[index] = new
|
||||
else:
|
||||
liste = liste + [ new ]
|
||||
|
@ -1498,7 +1498,7 @@ class base_proprietaire(base_classes_crans):
|
|||
self.services_to_restart('rouge-dhcp')
|
||||
|
||||
# Vérification si changement de bât, ce qui obligerai un changement d'IP
|
||||
if 'chbre' in self.modifs and self.chbre()!='????':
|
||||
if 'chbre' in self.modifs and self.chbre() != '????':
|
||||
# Verif si machines avec bonnes ip
|
||||
err = 0
|
||||
for m in self.machines():
|
||||
|
@ -1561,7 +1561,7 @@ class base_proprietaire(base_classes_crans):
|
|||
if action == None:
|
||||
return trans
|
||||
|
||||
if type(action)!=int: raise TypeError
|
||||
if type(action) != int: raise TypeError
|
||||
|
||||
touched = False
|
||||
if action>0 and action not in trans:
|
||||
|
@ -1670,7 +1670,7 @@ class adherent(base_proprietaire):
|
|||
# C'est un local club
|
||||
continue
|
||||
if int(a/14)>int((a-1)/14): aide += '\n '
|
||||
if c[0]!='X':
|
||||
if c[0] != 'X':
|
||||
aide += c.ljust(5)
|
||||
a = a+1
|
||||
aide += u'\n'
|
||||
|
@ -1684,7 +1684,7 @@ class adherent(base_proprietaire):
|
|||
test = self.exist('chbre=%s' % new)
|
||||
if test:
|
||||
search = test[0].split(',')[0]
|
||||
if search.split('=')[0]!='aid':
|
||||
if search.split('=')[0] != 'aid':
|
||||
raise ValueError(u'Chambre déjà occupée.')
|
||||
adh = self.search(search, self._modifiable)['adherent']
|
||||
if len(adh) != 1:
|
||||
|
@ -1712,7 +1712,7 @@ class adherent(base_proprietaire):
|
|||
addr = addr + ['']*(4-len(addr))
|
||||
return map(decode, addr)
|
||||
|
||||
if type(new)!=list and len(new)!=4:
|
||||
if type(new) != list and len(new) != 4:
|
||||
raise TypeError
|
||||
|
||||
l_min = [ 2, 0, 5, 2 ]
|
||||
|
@ -1743,7 +1743,7 @@ class adherent(base_proprietaire):
|
|||
# exactement un @
|
||||
# 2 ou 3 caractères après le . final
|
||||
# @ pas en premier ni juste avant le dernier .
|
||||
if new.count('@')!=1 \
|
||||
if new.count('@') != 1 \
|
||||
or not ( l-b == 4 or l-b == 3) \
|
||||
or a<1 or b-a<2:
|
||||
raise ValueError(u"Adresse mail incorrecte.")
|
||||
|
@ -1796,14 +1796,14 @@ class adherent(base_proprietaire):
|
|||
else:
|
||||
return ''
|
||||
|
||||
if type(index_or_new)!=list:
|
||||
if type(index_or_new) != list:
|
||||
raise TypeError
|
||||
|
||||
if not self._data.has_key('etudes'):
|
||||
self._data['etudes'] = ['', '', '']
|
||||
|
||||
# Pas grand chose à faire à part vérifier que ce sont bien des chaines
|
||||
if len(index_or_new)!=3:
|
||||
if len(index_or_new) != 3:
|
||||
raise ValueError(u"Format études non valides.")
|
||||
|
||||
new = ['', '', '']
|
||||
|
@ -1962,7 +1962,7 @@ class adherent(base_proprietaire):
|
|||
if not isadm:
|
||||
raise EnvironmentError(u'Il faut être administrateur pour effectuer cette opération.')
|
||||
|
||||
if type(droits)!=list:
|
||||
if type(droits) != list:
|
||||
raise TypeError(u'Une liste est attendue')
|
||||
|
||||
new = []
|
||||
|
@ -1992,7 +1992,7 @@ class adherent(base_proprietaire):
|
|||
self._set('rewriteMailHeaders', ['oui'])
|
||||
elif rewrite == False:
|
||||
self._set('rewriteMailHeaders', ['non'])
|
||||
elif rewrite!=None:
|
||||
elif rewrite != None:
|
||||
raise ValueError, u"rewriteMailHeaders prend un booléen comme argument"
|
||||
|
||||
# renvoie la valeur trouvée dans la base
|
||||
|
@ -2363,7 +2363,7 @@ class Machine(base_classes_crans):
|
|||
# Test si valide
|
||||
new = self.__host_alias('alias', new)
|
||||
|
||||
if index!=-1:
|
||||
if index != -1:
|
||||
liste[index] = new
|
||||
else:
|
||||
liste = liste + [new]
|
||||
|
@ -2931,7 +2931,7 @@ if __name__ == '__main__':
|
|||
--purgelock : supprime tous les locks de la base LDAP
|
||||
--menage : supprime les machines des anciens adhérents"""%sys.argv[0]
|
||||
|
||||
if len(sys.argv)!=2:
|
||||
if len(sys.argv) != 2:
|
||||
print usage
|
||||
sys.exit(1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue