- machines = getMachinesByOwner(user, machine)
- disk_usage = sum([sum([y.size for y in x.disks])
- for x in machines if x != machine])
+ if machine is not None:
+ machine_id = machine.machine_id
+ else:
+ machine_id = None
+ disk_usage = Disk.query().filter_by(Disk.c.machine_id != machine_id,
+ owner=user).sum(Disk.c.size) or 0