[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
19
attributs.py
19
attributs.py
|
@ -93,7 +93,7 @@ class Attr(object):
|
|||
|
||||
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
|
||||
peuvent tout voir. Par transparence, et par utilité, on autorise par
|
||||
défaut l'adhérent à voir les données le concernant."""
|
||||
|
@ -200,12 +200,17 @@ class intAttr(Attr):
|
|||
|
||||
class boolAttr(Attr):
|
||||
def parse_value(self, val, ldif):
|
||||
if not isinstance(val, bool):
|
||||
raise ValueError("Valeur pour attribut booléen invalide : %r" % val)
|
||||
if val.lower() == u'true':
|
||||
self.value = True
|
||||
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):
|
||||
return unicode(self.value)
|
||||
return unicode(self.value).upper()
|
||||
|
||||
class aid(intAttr):
|
||||
singlevalue = True
|
||||
|
@ -592,8 +597,11 @@ class positionBorne(Attr):
|
|||
optional = True
|
||||
|
||||
def parse_value(self, val, ldif):
|
||||
if val == u'N/A N/A':
|
||||
self.value = u"N/A°N N/A°E"
|
||||
else:
|
||||
lat, lon = val.split(" ")
|
||||
self.value = u"%f %f" % (float(lat), float(lon))
|
||||
self.value = u"%f°N %f°E" % (float(lat), float(lon))
|
||||
|
||||
class nvram(Attr):
|
||||
legend = u"Configuration speciale"
|
||||
|
@ -930,6 +938,7 @@ CRANS_ATTRIBUTES= {
|
|||
'tel' : tel,
|
||||
'paiement' : paiement,
|
||||
'controle': controle,
|
||||
'derniereConnexion' : derniereConnexion,
|
||||
'carteEtudiant' : carteEtudiant,
|
||||
'mailAlias' : mailAlias,
|
||||
'canonicalAlias' : canonicalAlias,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue