[PATCH 2 of 2 bootstrap] [py3] Use six.moves.range instead of xrange

Denis Laxalde denis.laxalde at logilab.fr
Mon Jun 4 14:55:23 CEST 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1528116857 -7200
#      Mon Jun 04 14:54:17 2018 +0200
# Node ID ee27da563be9e64112ffd6f587b7f4d87035655c
# Parent  f28609975dd7547e8db01d122ba399a29eb4b241
# Available At http://hg.logilab.org/review/cubes/bootstrap
#              hg pull http://hg.logilab.org/review/cubes/bootstrap -r ee27da563be9
# EXP-Topic py3
[py3] Use six.moves.range instead of xrange

At this point, flake8 and pylint no longer detect significant issues for
Python 3.

diff --git a/cubicweb_bootstrap/views/baseviews.py b/cubicweb_bootstrap/views/baseviews.py
--- a/cubicweb_bootstrap/views/baseviews.py
+++ b/cubicweb_bootstrap/views/baseviews.py
@@ -8,6 +8,7 @@
 __docformat__ = "restructuredtext en"
 
 from logilab.common.decorators import monkeypatch
+from six.moves import range
 
 from cubicweb.web.views import baseviews
 
@@ -30,7 +31,7 @@ def call(self, klass='list-striped', tit
         self.w(u'<%s class="%s">\n' % (self.listtag, klass or u''))
     else:
         self.w(u'<%s%s class="%s">\n' % (self.listtag, listid, klass or u''))
-    for i in xrange(self.cw_rset.rowcount):
+    for i in range(self.cw_rset.rowcount):
         self.cell_call(row=i, col=0, vid=subvid, klass=klass, **kwargs)
     self.w(u'</%s>\n' % self.listtag)
     if title:
@@ -52,7 +53,7 @@ def call(self,  klass='list-striped', **
         w(u'<h1>%s</h1>' % self.title)
     klass = u'' if klass is None else u' class="%s"' % klass
     w(u'<ul%s>\n' % klass)
-    for i in xrange(len(self.cw_rset)):
+    for i in range(len(self.cw_rset)):
         w(u'<li class="%s">' %  (u'odd' if i%2 else u'even'))
         self._cw.view(self.item_vid, self.cw_rset, row=i, col=0, w=w)
         w(u'</li>')


More information about the cubicweb-devel mailing list