Fix bug:range() is not same in py3.x and py2.x

in python3.x, there is no method named xrange(),
it has replaced by range(),which is equal to xrange() in python2.x.
so we must fix this issue.we use six module to fix this issue.

Change-Id: I9cee3f0df2d8abbf6f66d7c5a3a0fed98df622e8
Closes-Bug: #1268439
This commit is contained in:
lizheming 2014-01-17 11:58:42 +08:00
parent e17a90347d
commit 42683e1784
24 changed files with 25 additions and 1 deletions

View File

@ -15,6 +15,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from six.moves import xrange
import sqlalchemy import sqlalchemy
from sqlalchemy.orm.properties import RelationshipProperty from sqlalchemy.orm.properties import RelationshipProperty

View File

@ -27,6 +27,7 @@ from __future__ import print_function
import json import json
import re import re
from six.moves import xrange
from wsgiref.simple_server import make_server from wsgiref.simple_server import make_server

View File

@ -21,6 +21,7 @@
"""A Vlan Bitmap class to handle allocation/de-allocation of vlan ids.""" """A Vlan Bitmap class to handle allocation/de-allocation of vlan ids."""
from six.moves import xrange
from neutron.common import constants from neutron.common import constants
from neutron.plugins.brocade.db import models as brocade_db from neutron.plugins.brocade.db import models as brocade_db

View File

@ -21,6 +21,7 @@
import netaddr import netaddr
import re import re
from six.moves import xrange
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy.sql import and_ from sqlalchemy.sql import and_

View File

@ -16,6 +16,7 @@
# under the License. # under the License.
# @author: Alessandro Pilotti, Cloudbase Solutions Srl # @author: Alessandro Pilotti, Cloudbase Solutions Srl
from six.moves import xrange
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from six.moves import xrange
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc

View File

@ -14,6 +14,7 @@
# under the License. # under the License.
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy.orm import exc as sa_exc from sqlalchemy.orm import exc as sa_exc

View File

@ -16,6 +16,7 @@
import sys import sys
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import sqlalchemy as sa import sqlalchemy as sa
from neutron.common import constants as q_const from neutron.common import constants as q_const

View File

@ -15,6 +15,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from six.moves import xrange
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc

View File

@ -21,6 +21,7 @@ import time
import eventlet import eventlet
import netaddr import netaddr
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
from neutron.agent import l2population_rpc from neutron.agent import l2population_rpc
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from six.moves import xrange
from sqlalchemy import func from sqlalchemy import func
from sqlalchemy.orm import exc from sqlalchemy.orm import exc

View File

@ -17,6 +17,7 @@
# @author: Mark McClain, DreamHost # @author: Mark McClain, DreamHost
import itertools import itertools
from six.moves import xrange
from neutron.agent.linux import utils from neutron.agent.linux import utils
from neutron.plugins.common import constants as qconstants from neutron.plugins.common import constants as qconstants

View File

@ -17,6 +17,8 @@
import eventlet import eventlet
import fixtures import fixtures
from six.moves import xrange
from neutron.agent.linux import async_process from neutron.agent.linux import async_process
from neutron.tests import base from neutron.tests import base

View File

@ -23,6 +23,7 @@ import copy
from mock import patch from mock import patch
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
from webob import exc from webob import exc
from neutron.common.test_lib import test_config from neutron.common.test_lib import test_config

View File

@ -18,6 +18,7 @@
# @author: Abhishek Raut, Cisco Systems Inc. # @author: Abhishek Raut, Cisco Systems Inc.
# @author: Rudrajit Tapadar, Cisco Systems Inc. # @author: Rudrajit Tapadar, Cisco Systems Inc.
from six.moves import xrange
from sqlalchemy.orm import exc as s_exc from sqlalchemy.orm import exc as s_exc
from testtools import matchers from testtools import matchers

View File

@ -14,6 +14,7 @@
# limitations under the License. # limitations under the License.
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import testtools import testtools
from testtools import matchers from testtools import matchers

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from six.moves import xrange
import testtools import testtools
from testtools import matchers from testtools import matchers

View File

@ -15,6 +15,7 @@
# @author: Kyle Mestery, Cisco Systems, Inc. # @author: Kyle Mestery, Cisco Systems, Inc.
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import testtools import testtools
from testtools import matchers from testtools import matchers

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from six.moves import xrange
from testtools import matchers from testtools import matchers
from neutron.common import exceptions as n_exc from neutron.common import exceptions as n_exc

View File

@ -21,6 +21,7 @@ import time
import mock import mock
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import testtools import testtools
from neutron.agent.linux import ovs_lib from neutron.agent.linux import ovs_lib

View File

@ -18,6 +18,7 @@
import random import random
import mock import mock
from six.moves import xrange
from neutron.openstack.common import uuidutils from neutron.openstack.common import uuidutils
from neutron.plugins.nec.common import ofc_client from neutron.plugins.nec.common import ofc_client

View File

@ -17,6 +17,7 @@
import mock import mock
from oslo.config import cfg from oslo.config import cfg
from six.moves import xrange
import testtools import testtools
from testtools import matchers from testtools import matchers

View File

@ -19,6 +19,7 @@
import contextlib import contextlib
import mock import mock
from six.moves import xrange
from webob import exc from webob import exc
from neutron.common import exceptions from neutron.common import exceptions

View File

@ -18,6 +18,7 @@
import sys import sys
import mock import mock
from six.moves import xrange
from neutron.tests import base from neutron.tests import base
from neutron.tests import post_mortem_debug from neutron.tests import post_mortem_debug