Fix py34 error of indexing 'dict_keys' object

In python3, keys() of a dict isn't a list and cannot be indexed.

Change-Id: Iddced3a8856f4c66235779a7dde65d2604fae244
Closes-Bug: #1550184
This commit is contained in:
liusheng 2016-02-26 16:00:40 +08:00
parent f8a263029d
commit 3f6b80f514

View File

@ -52,7 +52,7 @@ class CompositeRule(wtypes.UserType):
@staticmethod
def valid_composite_rule(rules):
if isinstance(rules, dict) and len(rules) == 1:
and_or_key = rules.keys()[0]
and_or_key = list(rules)[0]
if and_or_key not in ('and', 'or'):
raise base.ClientSideError(
_('Threshold rules should be combined with "and" or "or"'))