Removing deprecated functions xrange and cmp

The functions xrange() and cmp() are not supported in python3.
This commit removes usage of these two.
Reference - https://docs.python.org/3.0/whatsnew/3.0.html

Change-Id: I26fd0d6a06cd2ddb32da17c4d6d7329d773f7828
This commit is contained in:
akhiljain23 2018-07-20 10:54:43 +05:30
parent c6d1225686
commit 5a0a161fd1
2 changed files with 5 additions and 3 deletions

View File

@ -202,7 +202,7 @@ class DetailView(tables.DataTableView):
# There could be another table with the same name and different
# arity. Divide the rows into unnamed columns. Number them for
# internal reference.
for i in xrange(0, row_len):
for i in range(0, row_len):
col_name = str(i)
column_names.append(col_name)
table_class_attrs[col_name] = tables.Column(
@ -226,7 +226,7 @@ class DetailView(tables.DataTableView):
try:
row_data = row['data']
row.delete_by_key('data')
for i in xrange(0, num_cols):
for i in range(0, num_cols):
row.set_value(column_names[i], row_data[i])
except Exception as e:
msg_args = {

View File

@ -98,7 +98,9 @@ class CreateConditions(workflows.Step):
def _compare_mapping_columns(self, x, y):
# x = "mapping_column_<int>", y = "mapping_column_<int>"
return cmp(int(x.split('_')[-1]), int(y.split('_')[-1]))
x = int(x.split('_')[-1])
y = int(y.split('_')[-1])
return (x > y) - (x < y)
def render(self):
# Overriding parent method to add extra template context variables.