don't crash if unit is not found

This commit is contained in:
Romain Bignon 2011-05-08 11:37:48 +02:00
commit dc15310118

View file

@ -57,7 +57,7 @@ def get_bytes_size(size, unit_name):
'GB': 1024 * 1024 * 1024,
'TB': 1024 * 1024 * 1024 * 1024,
}
return float(size * unit_data[unit_name])
return float(size * unit_data.get(unit_name, 1))
try: