diff options
| author | Isaku Yamahata <yamahata@valinux.co.jp> | 2011-06-15 15:08:23 +0900 |
|---|---|---|
| committer | Isaku Yamahata <yamahata@valinux.co.jp> | 2011-06-15 15:08:23 +0900 |
| commit | b3af5e4d5a623cf10828f4724f29dd4475120b70 (patch) | |
| tree | fdfca9cb574a63683ec403585d75f92f2fd97f53 /nova/api | |
| parent | c7e8f9ff46758ddbeecd049083bece013301bb59 (diff) | |
ec2utils: minor optimize _try_convert()
don't call lower() twice.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/ec2utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nova/api/ec2/ec2utils.py b/nova/api/ec2/ec2utils.py index 3d523016e..222e1de1e 100644 --- a/nova/api/ec2/ec2utils.py +++ b/nova/api/ec2/ec2utils.py @@ -61,9 +61,10 @@ def _try_convert(value): return '' if value == 'None': return None - if value.lower() == 'true': + lowered_value = value.lower() + if lowered_value == 'true': return True - if value.lower() == 'false': + if lowered_value == 'false': return False valueneg = value[1:] if value[0] == '-' else value if valueneg == '0': |
