Changeset 204 for trunk


Ignore:
Timestamp:
Oct 19, 2007, 10:16:48 PM (17 years ago)
Author:
ecprice
Message:

Add repr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-database/sipb-xen-database/sipb_xen_database/models.py

    r168 r204  
    5858
    5959class Machine(object):
    60     pass
     60    def __repr__(self):
     61        return "<Machine %s: name='%s' owner='%s'>" % (self.machine_id, self.name, self.owner)
    6162
    6263class NIC(object):
     
    6667        self.ip = ip
    6768        self.hostname = hostname
     69    def __repr__(self):
     70        return "<NIC: mac='%s' machine='%s' ip='%s' hostname='%s'>" % (self.mac_addr, self.machine_id, self.ip, self.hostname)
    6871
    6972class Disk(object):
     
    7275        self.guest_device_name = guest
    7376        self.size = size
     77    def __repr__(self):
     78        return "<Disk: machine=%s device=%s size=%s>" % (self.machine_id, self.guest_device_name, self.size)
    7479
    7580class Type(object):
    76     pass
     81    def __repr__(self):
     82        return "<Type %s: %s>" % (self.type_id, self.description)
    7783
    7884class CDROM(object):
     
    8086        self.cdrom_id = cdrom_id
    8187        self.description = description
     88    def __repr__(self):
     89        return "<CDROM %s: %s>" % (self.cdrom_id, self.description)
    8290
    8391assign_mapper(ctx, Machine, machine_table,
Note: See TracChangeset for help on using the changeset viewer.