From 321b24eb7e4c98e8beb19370950f396dbe5288bd Mon Sep 17 00:00:00 2001 From: zhangyangyang Date: Sat, 1 Sep 2018 17:28:14 +0800 Subject: [PATCH] Python 3 compatibility: fix xrange/range issues xrange is not defined in python3. Rename xrange() to range(). Story: 2003430 Task: 25738 Change-Id: I267864d9b0ff9134fadc0864bee7f9d7095eb621 Signed-off-by: zhangyangyang --- service-mgmt-api/sm-api/sm_api/common/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service-mgmt-api/sm-api/sm_api/common/utils.py b/service-mgmt-api/sm-api/sm_api/common/utils.py index 00fc7238..759495de 100644 --- a/service-mgmt-api/sm-api/sm_api/common/utils.py +++ b/service-mgmt-api/sm-api/sm_api/common/utils.py @@ -232,13 +232,13 @@ def trycmd(*args, **kwargs): def generate_uid(topic, size=8): characters = '01234567890abcdefghijklmnopqrstuvwxyz' - choices = [random.choice(characters) for _x in xrange(size)] + choices = [random.choice(characters) for _x in range(size)] return '%s-%s' % (topic, ''.join(choices)) def random_alnum(size=32): characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - return ''.join(random.choice(characters) for _ in xrange(size)) + return ''.join(random.choice(characters) for _ in range(size)) class LazyPluggable(object):