From: Eric Price Date: Sat, 20 Oct 2007 02:16:48 +0000 (-0400) Subject: Add __repr__. X-Git-Tag: sipb-xen-database/10~3 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-database.git/commitdiff_plain/1e32a827b3a96d30d69553288350279b69a83cc4 Add __repr__. svn path=/trunk/packages/sipb-xen-database/sipb-xen-database/; revision=204 --- diff --git a/sipb_xen_database/models.py b/sipb_xen_database/models.py index b4380b9..730cc8b 100644 --- a/sipb_xen_database/models.py +++ b/sipb_xen_database/models.py @@ -57,7 +57,8 @@ cdroms_table = Table('cdroms', meta, class Machine(object): - pass + def __repr__(self): + return "" % (self.machine_id, self.name, self.owner) class NIC(object): def __init__(self, machine_id, mac_addr, ip, hostname): @@ -65,20 +66,27 @@ class NIC(object): self.mac_addr = mac_addr self.ip = ip self.hostname = hostname + def __repr__(self): + return "" % (self.mac_addr, self.machine_id, self.ip, self.hostname) class Disk(object): def __init__(self, machine_id, guest, size): self.machine_id = machine_id self.guest_device_name = guest self.size = size + def __repr__(self): + return "" % (self.machine_id, self.guest_device_name, self.size) class Type(object): - pass + def __repr__(self): + return "" % (self.type_id, self.description) class CDROM(object): def __init__(self, cdrom_id, description): self.cdrom_id = cdrom_id self.description = description + def __repr__(self): + return "" % (self.cdrom_id, self.description) assign_mapper(ctx, Machine, machine_table, properties={'nics': relation(NIC, backref="machine"),