[attributs] Assouplissement sur le formatage de certain attributs

This commit is contained in:
Valentin Samir 2012-11-04 03:34:38 +01:00
parent a06b40b4e0
commit 5d9c732197

View file

@ -205,7 +205,7 @@ class yearAttr(intAttr):
def parse_value(self, val, ldif):
if int(val) < 1998 or int(val) > config.ann_scol:
raise ValueError("Année invalide (%s)" % val)
raise ValueError("Annee invalide (%s)" % val)
self.value = int(val)
@ -471,11 +471,11 @@ class blacklist(Attr):
def parse_value(self, bl, ldif):
bl_debut, bl_fin, bl_type, bl_comm = bl.split('$')
now = time.time()
self.value = { 'debut' : int (bl_debut),
self.value = { 'debut' : bl_debut if bl_debut == '-' else int (bl_debut),
'fin' : bl_fin if bl_fin == '-' else int(bl_fin),
'type' : bl_type,
'comm' : bl_comm,
'actif' : int(bl_debut) < now and (bl_fin == '-' or int(bl_fin) > now) }
'actif' : (bl_debut == '-' or int(bl_debut) < now) and (bl_fin == '-' or int(bl_fin) > now) }
def is_actif(self):
return self.value['actif']