[pep8] Fix various pep8 error
authorNoe Gaumont <ngaumont@logilab.fr>
Fri, 21 Jun 2019 11:25:29 +0200
changeset 68 fe54cb21b419
parent 67 bfba2d98ced1
child 69 5e315c7545cf
[pep8] Fix various pep8 error
cubicweb_treeview/views/formwidgets.py
cubicweb_treeview/views/treeview.py
--- a/cubicweb_treeview/views/formwidgets.py	Fri Jun 21 11:19:10 2019 +0200
+++ b/cubicweb_treeview/views/formwidgets.py	Fri Jun 21 11:25:29 2019 +0200
@@ -24,8 +24,6 @@
 _ = unicode
 
 
-
-
 class TreeViewWidget(fwdgs.FieldWidget):
     """form widget to link to keywords of a given classification"""
 
@@ -36,7 +34,7 @@
     needs_css = ('jquery.treeview.css', 'jquery.ui.css', 'cubes.treeview.css')
 
     html = (u'''<a href="javascript:$.noop()" '''
-            u'''onclick="$('#%(tree_uid)s').treewidget(%(required)s, %(multiple)s, false, {'cancelButton': '%(cancel)s', 'okButton': '%(ok)s'}) ;return false;">'''
+            u'''onclick="$('#%(tree_uid)s').treewidget(%(required)s, %(multiple)s, false, {'cancelButton': '%(cancel)s', 'okButton': '%(ok)s'}) ;return false;">'''  # noqa
             u'''%(open_link)s&nbsp;%(remove_link)s</a>'''
             u'''<div id="sel_%(tree_uid)s">%(selected)s</div>'''
             u'''<div id="%(tree_uid)s" style="display: none;">'''
@@ -69,10 +67,11 @@
         related = self.compute_related(form, field)
         treeform = self.render_treeform(form, treerset, tree_uid, related)
         remove_link = self.remove_link_html % (field.name, tree_uid, _('remove'))
+        selected = u'\n'.join(self.render_selected(field.input_name(form, self.suffix), related))
         return self.html % {
             'required': self.required,
             'multiple': self.multiple,
-            'selected': u'\n'.join(self.render_selected(field.input_name(form, self.suffix), related)),
+            'selected': selected,
             'tree_uid': tree_uid, 'form': treeform,
             'open_link': xml_escape(_('select').capitalize()),
             'remove_link': remove_link,
@@ -127,6 +126,7 @@
             yield tags.input(id=name, name=name, value='', type='hidden')
         for keyword in related:
             input = tags.input(id=name, name=name, value=keyword.eid, type='hidden')
-            yield tags.div(u'<a href="javascript:$.noop()" onclick="$(this).parent().remove()">[x]</a>'
+            yield tags.div(u'<a href="javascript:$.noop()" onclick="$(this).parent().remove()">[x]'
+                           u'</a>'
                            u'%(input)s %(title)s' % {'input': input,
                                                      'title': xml_escape(keyword.dc_title())})
--- a/cubicweb_treeview/views/treeview.py	Fri Jun 21 11:19:10 2019 +0200
+++ b/cubicweb_treeview/views/treeview.py	Fri Jun 21 11:25:29 2019 +0200
@@ -19,15 +19,12 @@
 __docformat__ = "restructuredtext en"
 from cubicweb.uilib import cut
 from cubicweb.web.views import baseviews, treeview
-from cubicweb.predicates import is_instance, match_kwargs, adaptable
+from cubicweb.predicates import match_kwargs, adaptable
 from logilab.mtconverter import xml_escape
 import json
 _ = unicode
 
 
-
-
-
 class TVTreeViewItemView(treeview.TreeViewItemView):
 
     def _is_leaf(self, itree):
@@ -116,7 +113,7 @@
     __regid__ = 'itemvid_edit'
     __select__ = (treeview.TreeView.__select__
                   & (match_kwargs('related', 'required', 'multiple', 'leavesonly',
-                                'tree_uid', 'level')))
+                                  'tree_uid', 'level')))
     _open_branch_memo = None
 
     def open_state(self, eeid, treeid):
@@ -126,8 +123,8 @@
                   is_last=False, **morekwargs):
         entity = self.cw_rset.get_entity(row, col)
         self._open_branch_memo = set(entity.cw_adapt_to('ITree').path())
-        return super(TVTreeViewEditItemView, self).cell_call(row, col, treeid, vid=vid, parentvid=parentvid,
-                  is_last=is_last, **morekwargs)
+        return super(TVTreeViewEditItemView, self).cell_call(
+            row, col, treeid, vid=vid, parentvid=parentvid, is_last=is_last, **morekwargs)
 
     def _is_leaf(self, itree):
         return itree is None or itree.is_editable_leaf()
@@ -142,14 +139,15 @@
     itemvid = 'itemvid_edit'
     __select__ = (treeview.TreeView.__select__
                   & (match_kwargs('related', 'required', 'multiple', 'leavesonly',
-                                'tree_uid', 'level')) & adaptable('ITree'))
+                                  'tree_uid', 'level')) & adaptable('ITree'))
 
     def _init_params(self, subvid, treeid, initial_load, initial_thru_ajax, morekwargs):
         form = self._cw.form
         initial_fname = form.get('fname', None)
         if initial_fname == 'reledit_form':
             form.pop('fname')
-        return super(TVTreeEditView, self)._init_params(subvid, treeid, initial_load, initial_thru_ajax, morekwargs)
+        return super(TVTreeEditView, self)._init_params(
+            subvid, treeid, initial_load, initial_thru_ajax, morekwargs)
 
 
 class TVNotTreeEditView(treeview.DefaultTreeViewItemView):
@@ -190,7 +188,8 @@
                        % {'eid': entity.eid, 'sel': entity.eid
                           in related and u'checked="checked"' or u''})
                 self.w(u'<span class="hidden">%s</span>' % entity_name)
-                self.w(u'<a href="javascript:$.noop()" onclick="$(\'#treeitem_%s\').click()" class="selectable">'
+                self.w(u'<a href="javascript:$.noop()" onclick="$(\'#treeitem_%s\').click()"'
+                       u'class="selectable">'
                        u'%s</a>' % (entity.eid, entity_name))
             else:
                 self.w(u'<span>%s</span>' % (entity_name))