Changeset 238 for trunk/packages
- Timestamp:
- Nov 12, 2007, 4:22:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-database/sipb-xen-database/sipb_xen_database/models.py
r204 r238 56 56 Column('description', String, nullable=False)) 57 57 58 machine_access_table = Table('machine_access', meta, 59 Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=False, index=True), 60 Column('user', String, nullable=False, index=True), 61 PrimaryKeyConstraint('machine_id', 'user')) 58 62 59 63 class Machine(object): 60 64 def __repr__(self): 61 65 return "<Machine %s: name='%s' owner='%s'>" % (self.machine_id, self.name, self.owner) 66 67 class MachineAccess(object): 68 def __repr__(self): 69 return "<MachineAccess machine='%s' user='%s'>" % (self.machine, self.user) 62 70 63 71 class NIC(object): … … 92 100 properties={'nics': relation(NIC, backref="machine"), 93 101 'disks': relation(Disk, backref="machine"), 94 'type': relation(Type)}); 102 'type': relation(Type), 103 'users': relation(MachineAccess, backref="machine")}); 104 assign_mapper(ctx, MachineAccess, machine_access_table) 95 105 assign_mapper(ctx, NIC, nic_table) 96 106 assign_mapper(ctx, Disk, disk_table) 97 107 assign_mapper(ctx, Type, types_table) 98 108 assign_mapper(ctx, CDROM, cdroms_table) 99
Note: See TracChangeset
for help on using the changeset viewer.