Commit 7c57fd68 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[py3] Remove Python2 idioms thanks to "modernize"

parent a79d4194d33d
......@@ -17,6 +17,8 @@
"""cubicweb-slickgrid views/forms/actions/components for web ui"""
import six
from cubicweb import tags
from cubicweb.dataimport import ucsvreader
from cubicweb.uilib import js
......@@ -63,7 +65,7 @@ class EditableSlickGridWidget(FieldWidget):
data = self.get_data(form, field, columns)
divid = 'grid_{0}_{1}'.format(field.role_name(),
form.edited_entity.eid)
form._cw.add_onload(unicode(
form._cw.add_onload(six.text_type(
js.cw.slickgrid.editableGrid(
'#%s' % divid, columns, data,
self.default_grid_options)) + ';')
......
......@@ -17,6 +17,7 @@
"""cubicweb-slickgrid views/forms/actions/components for web ui"""
import six
from cubicweb.web.views import tableview
from cubicweb.uilib import js
......@@ -81,7 +82,7 @@ class GridLayout(tableview.TableLayout):
# synchronously add slickgrid rendering then every other js
# from cells renderers
onloads.insert(0, unicode(onload_call))
onloads.insert(0, six.text_type(onload_call))
cnx.add_onload('\n'.join(onloads))
def get_js(self, divid):
......@@ -89,7 +90,7 @@ class GridLayout(tableview.TableLayout):
colrenderers = view.build_column_renderers()
headers = self.render_table_headers(colrenderers)
data = self.render_table_body(colrenderers)
return unicode(
return six.text_type(
js.cw.slickgrid.displayGrid(
'#%s' % divid, headers, data,
view.default_grid_options,
......@@ -110,11 +111,11 @@ class GridLayout(tableview.TableLayout):
def render_table_body(self, colrenderers):
return [self.render_row(rownum, colrenderers)
for rownum in xrange(self.cw_rset.rowcount)]
for rownum in range(self.cw_rset.rowcount)]
def render_row(self, rownum, renderers):
row = {'id': rownum}
row.update((unicode(cr.colid), self.render_cell(rownum, cr))
row.update((six.text_type(cr.colid), self.render_cell(rownum, cr))
for cr in renderers)
return row
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment