[views] Fix flake8 error in main template
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 03 Feb 2017 14:29:10 +0100
changeset 65 b6d714abd494
parent 64 29eb8d663df3
child 66 245b53dbd993
[views] Fix flake8 error in main template
views/templates.py
--- a/views/templates.py	Thu Jan 19 12:31:09 2017 +0100
+++ b/views/templates.py	Fri Feb 03 14:29:10 2017 +0100
@@ -16,9 +16,10 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 """sherpa views/templates"""
 
-from six import string_types, text_type as _
-from cwtags import tag as T
+from six import text_type as _
+
 from logilab.common.decorators import monkeypatch
+
 from cubicweb.utils import json_dumps, HTMLHead, UStringIO
 from cubicweb.web.views import basetemplates
 
@@ -28,6 +29,7 @@
 # Bootstrap configuration.
 basetemplates.TheMainTemplate.twbs_container_cls = 'container-fluid'
 
+
 @monkeypatch(HTMLHead)
 def add_onload(self, jscode):
     """original `add_onload` implementation use `$(cw)`
@@ -37,6 +39,7 @@
   %s
 });""" % jscode)
 
+
 class SherpaMainTemplate(basetemplates.TheMainTemplate):
 
     def _handle_added_resources(self, tmpl_context):
@@ -74,23 +77,20 @@
         context['page_content'] = page_content
         self.w(jinja_render('maintemplate', **context))
 
-
     def template_context(self, view):
-
         req = self._cw
 
+        # left boxes
         left_boxes = list(self._cw.vreg['ctxcomponents'].poss_visible_objects(
             req, rset=self.cw_rset, view=view, context='left'))
-
-        #left boxes
         stream = UStringIO()
         for box in left_boxes:
             box.render(w=stream.write, view=view)
         left_boxes_html = stream.getvalue()
 
-        #header
+        # header
         stream = UStringIO()
-        w=stream.write
+        w = stream.write
         components = self.get_components(view, context='header-right')
         if components:
             w(u'<ul class="nav navbar-nav navbar-right">')
@@ -101,9 +101,9 @@
             w(u'</ul>')
         right_header_component = stream.getvalue()
 
-        #breadcrumbs
+        # breadcrumbs
         stream = UStringIO()
-        w=stream.write
+        w = stream.write
         components = self.get_components(view, context='header-center')
         if components:
             for component in components:
@@ -137,13 +137,13 @@
                     {'url': self._cw.build_url('SEDAArchiveTransfer'),
                      'label': _('Profils SEDA')}
                 ],
-                'navigation_Link':[
+                'navigation_Link': [
                     {'url': self._cw.build_url('project'),
-                    'label': _('Le projet Sherpa')},
+                     'label': _('Le projet Sherpa')},
                     {'url': self._cw.build_url('utilisation'),
                      'label': _("Mode d'emploi")},
                     {'url': self._cw.build_url('seda'),
-                      'label': _("Le SEDA")},
+                     'label': _("Le SEDA")},
                 ]
             },
             'left_boxes': left_boxes_html,
@@ -157,5 +157,6 @@
 
         return ctx
 
+
 def registration_callback(vreg):
     vreg.register_and_replace(SherpaMainTemplate, basetemplates.TheMainTemplate)