[attributs] Il en manquait pas mal
This commit is contained in:
parent
a879c126af
commit
5601c523c0
2 changed files with 88 additions and 2 deletions
88
attributs.py
88
attributs.py
|
@ -198,6 +198,15 @@ class intAttr(Attr):
|
|||
def __unicode__(self):
|
||||
return unicode(self.value)
|
||||
|
||||
class boolAttr(Attr):
|
||||
def parse_value(self, val, ldif):
|
||||
if not isinstance(val, bool):
|
||||
raise ValueError("Valeur pour attribut booléen invalide : %r" % val)
|
||||
self.value = val
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.value)
|
||||
|
||||
class aid(intAttr):
|
||||
singlevalue = True
|
||||
optional = True
|
||||
|
@ -286,6 +295,10 @@ class carteEtudiant(yearAttr):
|
|||
category = 'perso'
|
||||
can_modify = [cableur, nounou, tresorier]
|
||||
|
||||
class derniereConnexion(intAttr):
|
||||
legend = u"Dernière connexion"
|
||||
can_modify = []
|
||||
|
||||
class mail(Attr):
|
||||
singlevalue = True
|
||||
optional = False
|
||||
|
@ -334,6 +347,17 @@ class mailAlias(mail):
|
|||
raise ValueError("Alias mail invalide (%r)" % val)
|
||||
self.value = val
|
||||
|
||||
class mailInvalide(boolAttr):
|
||||
optional = True
|
||||
legend = u"Mail invalide"
|
||||
can_modify = [bureau, nounou]
|
||||
|
||||
class contourneGreylist(boolAttr):
|
||||
optionnal = True
|
||||
legend = u"Contourner la greylist"
|
||||
category = 'mail'
|
||||
can_modify = [soi]
|
||||
|
||||
class etudes(Attr):
|
||||
singlevalue = False
|
||||
optional = False
|
||||
|
@ -553,6 +577,32 @@ class canal(intAttr):
|
|||
category = 'wifi'
|
||||
can_modify = [nounou]
|
||||
|
||||
class hotspot(boolAttr):
|
||||
singlevalue = True
|
||||
optional = True
|
||||
legend = u'Hotspot'
|
||||
category = 'wifi'
|
||||
can_modify = [nounou]
|
||||
|
||||
class positionBorne(Attr):
|
||||
legend = u"Position de la borne"
|
||||
category = "wifi"
|
||||
can_modify = [nounou]
|
||||
singlevalue = True
|
||||
optional = True
|
||||
|
||||
def parse_value(self, val, ldif):
|
||||
lat, lon = val.split(" ")
|
||||
self.value = u"%f %f" % (float(lat), float(lon))
|
||||
|
||||
class nvram(Attr):
|
||||
legend u"Configuration speciale"
|
||||
optional = True
|
||||
can_modify = [nounou]
|
||||
|
||||
def parse_value(self, val, ldif):
|
||||
pass
|
||||
|
||||
class portAttr(Attr):
|
||||
singlevalue = False
|
||||
optional = True
|
||||
|
@ -604,6 +654,13 @@ class portUDPin(portAttr):
|
|||
class exempt(Attr):
|
||||
legend = u"Exemption vers une IP"
|
||||
|
||||
class nombrePrise(intAttr):
|
||||
legend = u"Nombre de prises ethernet de la machine"
|
||||
singlevalue = True
|
||||
optional = True
|
||||
categoriy = 'base_tech'
|
||||
can_modify = [nounou]
|
||||
|
||||
class prise(Attr):
|
||||
singlevalue = True
|
||||
optional = True
|
||||
|
@ -630,7 +687,7 @@ class responsable(Attr):
|
|||
optional = True
|
||||
legend = u"Responsable du club"
|
||||
category = 'perso'
|
||||
can_modify = [nounou]
|
||||
can_modify = [cableur, nounou]
|
||||
|
||||
def get_respo(self):
|
||||
if self.value == None:
|
||||
|
@ -644,6 +701,21 @@ class responsable(Attr):
|
|||
def __unicode__(self):
|
||||
return self.__resp
|
||||
|
||||
class imprimeurClub(Attr):
|
||||
optional = True
|
||||
legend = u"Imprimeur du club"
|
||||
category = "perso"
|
||||
can_modify = [cableur, nounou]
|
||||
|
||||
def parse_value(self, val, ldif):
|
||||
res = self.conn.search('aid=%s' % int(val))
|
||||
if len(res) != 1:
|
||||
raise ValueError("L'adhérent aid=%r n'existe plus." % val)
|
||||
self.value = res[0]
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.value['aid'][0])
|
||||
|
||||
class blacklist(Attr):
|
||||
singlevalue = False
|
||||
optional = True
|
||||
|
@ -821,6 +893,20 @@ class controle(Attr):
|
|||
else:
|
||||
self.value = ctrl
|
||||
|
||||
class fid(intAttr):
|
||||
legend = u"Id de facture"
|
||||
category = 'factures'
|
||||
optional = False
|
||||
singlevalue = True
|
||||
|
||||
class modePaiement(Attr):
|
||||
legend = u"Mode de paiement"
|
||||
category = 'factures'
|
||||
optional = False
|
||||
singlevalue = True
|
||||
|
||||
class recuPaiement(Attr):
|
||||
pass
|
||||
|
||||
### Les classes
|
||||
ADHERENT_ATTRS = [ nom, prenom, tel, chbre, postalAddress, mail, uid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue