1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
class Vtek_Fonction(object):
def __init__(self):
self.id = 0
self.nom = ''
class A() :
def Avoir_List_Dispo( self, entite):#Liste les fonctions disponibles pour l'entite passer en parametre
array = [ { "id_fonc" : 12, "fonc_nom" : 'foo'}, { "id_fonc" : 4, "fonc_nom" : 'bar'}, { "id_fonc" : 10, "fonc_nom" : 'toto'} ]
fonctions = []
for row in array:#Je creer une liste de liste qui contient ID et nom de fonction
fonction = Vtek_Fonction()
fonction.id = row['id_fonc']
fonction.nom = row['fonc_nom']
fonctions.append( fonction )
return fonctions
a = A()
for obj in a.Avoir_List_Dispo( None ) :
print id( obj ) |