summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-06-15 15:08:23 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-06-15 15:08:23 +0900
commitb3af5e4d5a623cf10828f4724f29dd4475120b70 (patch)
treefdfca9cb574a63683ec403585d75f92f2fd97f53 /nova/api
parentc7e8f9ff46758ddbeecd049083bece013301bb59 (diff)
ec2utils: minor optimize _try_convert()
don't call lower() twice.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/ec2utils.py5
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':