[attributs] Bug fixes sur les attributs concernant les bornes, et ajout d'un attribut manquant à la lookup table
This commit is contained in:
parent
c06e77fee9
commit
23ebf9de76
1 changed files with 16 additions and 7 deletions
23
attributs.py
23
attributs.py
|
@ -93,7 +93,7 @@ class Attr(object):
|
||||||
|
|
||||||
can_modify = [nounou]
|
can_modify = [nounou]
|
||||||
|
|
||||||
can_view = [nounou, apprenti, soi, parent, responsable]
|
can_view = [nounou, apprenti, soi, parent, respo]
|
||||||
"""Qui peut voir l'attribut. Par défaut, les Nounous et les Apprentis
|
"""Qui peut voir l'attribut. Par défaut, les Nounous et les Apprentis
|
||||||
peuvent tout voir. Par transparence, et par utilité, on autorise par
|
peuvent tout voir. Par transparence, et par utilité, on autorise par
|
||||||
défaut l'adhérent à voir les données le concernant."""
|
défaut l'adhérent à voir les données le concernant."""
|
||||||
|
@ -200,12 +200,17 @@ class intAttr(Attr):
|
||||||
|
|
||||||
class boolAttr(Attr):
|
class boolAttr(Attr):
|
||||||
def parse_value(self, val, ldif):
|
def parse_value(self, val, ldif):
|
||||||
if not isinstance(val, bool):
|
if val.lower() == u'true':
|
||||||
raise ValueError("Valeur pour attribut booléen invalide : %r" % val)
|
self.value = True
|
||||||
self.value = val
|
elif val.lower() == u'false':
|
||||||
|
self.value = False
|
||||||
|
elif isinstance(val, bool):
|
||||||
|
self.value = val
|
||||||
|
else:
|
||||||
|
raise ValueError("%r doit être un booléen !" % val)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.value)
|
return unicode(self.value).upper()
|
||||||
|
|
||||||
class aid(intAttr):
|
class aid(intAttr):
|
||||||
singlevalue = True
|
singlevalue = True
|
||||||
|
@ -592,8 +597,11 @@ class positionBorne(Attr):
|
||||||
optional = True
|
optional = True
|
||||||
|
|
||||||
def parse_value(self, val, ldif):
|
def parse_value(self, val, ldif):
|
||||||
lat, lon = val.split(" ")
|
if val == u'N/A N/A':
|
||||||
self.value = u"%f %f" % (float(lat), float(lon))
|
self.value = u"N/A°N N/A°E"
|
||||||
|
else:
|
||||||
|
lat, lon = val.split(" ")
|
||||||
|
self.value = u"%f°N %f°E" % (float(lat), float(lon))
|
||||||
|
|
||||||
class nvram(Attr):
|
class nvram(Attr):
|
||||||
legend = u"Configuration speciale"
|
legend = u"Configuration speciale"
|
||||||
|
@ -930,6 +938,7 @@ CRANS_ATTRIBUTES= {
|
||||||
'tel' : tel,
|
'tel' : tel,
|
||||||
'paiement' : paiement,
|
'paiement' : paiement,
|
||||||
'controle': controle,
|
'controle': controle,
|
||||||
|
'derniereConnexion' : derniereConnexion,
|
||||||
'carteEtudiant' : carteEtudiant,
|
'carteEtudiant' : carteEtudiant,
|
||||||
'mailAlias' : mailAlias,
|
'mailAlias' : mailAlias,
|
||||||
'canonicalAlias' : canonicalAlias,
|
'canonicalAlias' : canonicalAlias,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue