Ajout de méthodes __unicode__ sur les objets
This commit is contained in:
parent
e46d1fe338
commit
f988e962c9
1 changed files with 33 additions and 8 deletions
41
objets.py
41
objets.py
|
@ -848,8 +848,11 @@ def crans_object(classe):
|
|||
class InetOrgPerson(CransLdapObject):
|
||||
__slots__ = ()
|
||||
ldap_name = "inetOrgPerson"
|
||||
def __unicode__(self):
|
||||
return u"%s : cn=%s" % (self.__class__.__name__, self['cn'][0])
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__) + " : cn=" + str(self['cn'][0])
|
||||
return str(self.__unicode__())
|
||||
pass
|
||||
|
||||
class proprio(CransLdapObject):
|
||||
|
@ -889,8 +892,11 @@ class proprio(CransLdapObject):
|
|||
"""Renvoie la liste des clubs dont l'adherent est imprimeur (surchargée dans les objets adherent)"""
|
||||
return []
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s : nom=%s" % (self.__class__.__name__, self['nom'][0])
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__) + " : nom=" + str(self['nom'][0])
|
||||
return str(self.__unicode__())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(proprio, self).__init__(*args, **kwargs)
|
||||
|
@ -1166,8 +1172,11 @@ class machine(CransLdapObject):
|
|||
attributs.ipHostNumber, attributs.ip6HostNumber, attributs.historique,
|
||||
attributs.dnsIpv6, attributs.machineAlias]
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s : host=%s" % (self.__class__.__name__, self['host'][0])
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__) + " : host=" + str(self['host'][0])
|
||||
return str(self.__unicode__())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(machine, self).__init__(*args, **kwargs)
|
||||
|
@ -1344,14 +1353,21 @@ class AssociationCrans(proprio):
|
|||
|
||||
def delete(self, comm, login):
|
||||
pass
|
||||
|
||||
def __unicode__(self):
|
||||
return u"Le Crans"
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__) + " : Le Crans"
|
||||
return str(self.__unicode__())
|
||||
|
||||
class BaseInvites(proprio):
|
||||
u"""Un artefact de la base ldap"""
|
||||
__slots__ = ()
|
||||
def __unicode__(self):
|
||||
return u"%s" % (self.__class__.__name__,)
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__)
|
||||
return str(self.__unicode__())
|
||||
|
||||
def delete(self, comm, login):
|
||||
raise EnvironmentError("Les pauvres invites")
|
||||
|
@ -1371,8 +1387,11 @@ class adherent(proprio):
|
|||
]
|
||||
ldap_name = "adherent"
|
||||
|
||||
def __unicode__(self):
|
||||
return u"Adhérent : %s %s" % (self['prenom'][0], self['nom'][0])
|
||||
|
||||
def __repr__(self):
|
||||
return "Adhérent : " + str(self['prenom'][0]) + " " + str(self['nom'][0])
|
||||
return str(self.__unicode__())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(adherent, self).__init__(*args, **kwargs)
|
||||
|
@ -1415,8 +1434,11 @@ class club(proprio):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(club, self).__init__(*args, **kwargs)
|
||||
|
||||
def __unicode__(self):
|
||||
return u"Club : %s" % (self['nom'][0],)
|
||||
|
||||
def __repr__(self):
|
||||
return "Club : " + str(self['nom'][0])
|
||||
return str(self.__unicode__())
|
||||
|
||||
@crans_object
|
||||
class machineFixe(machine):
|
||||
|
@ -1508,8 +1530,11 @@ class facture(CransLdapObject):
|
|||
attributs.finConnexion, attributs.controle ]
|
||||
ldap_name = "facture"
|
||||
|
||||
def __unicode__(self):
|
||||
return u"Facture : fid=%s" % (self['fid'][0],)
|
||||
|
||||
def __repr__(self):
|
||||
return str(self.__class__.__name__) + " : fid=" + str(self['fid'][0])
|
||||
return str(self.__unicode__())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._proprio = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue