Commit 8bed4176 authored by Nicolas Chauvat's avatar Nicolas Chauvat
Browse files

Trying to make flake8 happier

parent b7e1cf8a06dc
......@@ -21,6 +21,7 @@ from cubicweb_bootstrap import CW_325
basecomponents.CookieLoginComponent._html = (
u'<a class="icon-login" data-toggle="modal" href="#loginModal">%s</a>')
@monkeypatch(basecomponents.CookieLoginComponent)
def call(self):
self.w(self._html % self._cw._('i18n_login_popup'))
......@@ -34,23 +35,24 @@ def call(self):
});''')
# NOTE: CW 3.18 may introduce render_messages(). This would be the
# the only method to override
@monkeypatch(basecomponents.ApplicationMessage)
@monkeypatch(basecomponents.ApplicationMessage) # noqa: F811
def call(self, msg=None):
if msg is None:
msg = self._cw.message # XXX don't call self._cw.message twice
msg = self._cw.message # XXX don't call self._cw.message twice
if msg:
self.w(u'<div class="alert alert-info" id="%s">'
u'<button class="close" data-dismiss="alert" type="button">x</button>'
u' %s</div>' % (self.domid, msg))
@monkeypatch(basecomponents.ApplLogo)
def render(self, w):
w(u'<a id="logo" href="%s"></a>' % self._cw.base_url())
@monkeypatch(basecomponents.ApplicationName)
@monkeypatch(basecomponents.ApplicationName) # noqa: F811
def render(self, w, **kwargs):
title = self._cw.property_value('ui.site-title')
if title:
......@@ -119,15 +121,16 @@ class BSRQLInputForm(basecomponents.RQLInputForm):
% (req.build_url('json', fname='rql_suggest')))
hidden = u''
if req.search_state[0] != 'normal':
hidden = u'<input type="hidden" name="__mode" value="%s"/>' % \
hidden = u'<input type="hidden" name="__mode" value="%s"/>' % \
':'.join(req.search_state[1])
self.w(self.formdef % {'css_class':not self.cw_propval('visible') and 'hidden' or '',
self.w(self.formdef % {'css_class': not self.cw_propval('visible') and 'hidden' or '',
'action': req.build_url('view'),
'rql': xml_escape(rql),
'title': req._('full text or RQL query'),
'ind': req.next_tabindex() if not CW_325 else u'',
'hidden': hidden})
def registration_callback(vreg):
components = (
(BSAuthenticatedUserStatus, basecomponents.AuthenticatedUserStatus),
......
......@@ -46,7 +46,7 @@ def cell_call(self, row, col=0, vid=None, klass=None, **kwargs):
self.w(u'</li>\n')
@monkeypatch(baseviews.SameETypeListView)
@monkeypatch(baseviews.SameETypeListView) # noqa: F811
def call(self, klass='list-striped', **kwargs):
w = self.w
showtitle = kwargs.pop('showtitle', 'vtitle' not in self._cw.form)
......@@ -61,7 +61,7 @@ def call(self, klass='list-striped', **kwargs):
w(u'</ul>\n')
@monkeypatch(baseviews.MetaDataView)
@monkeypatch(baseviews.MetaDataView) # noqa: F811
def cell_call(self, row, col):
_ = self._cw._
entity = self.cw_rset.get_entity(row, col)
......
......@@ -103,7 +103,7 @@ def call(self, **kwargs):
w(u'<p>%s</p>' % _('no web sessions found'))
@monkeypatch(debug.RegistryView)
@monkeypatch(debug.RegistryView) # noqa: F811
def call(self, **kwargs):
self.w(u'<h2>%s</h2>' % self._cw._("Registry's content"))
keys = sorted(self._cw.vreg)
......
......@@ -19,7 +19,7 @@ def form_title(self, entity):
entity.dc_type(), ptitle and '(%s)' % ptitle))
@monkeypatch(editforms.CreationFormView)
@monkeypatch(editforms.CreationFormView) # noqa: F811
def form_title(self, entity):
"""the form view title"""
if '__linkto' in self._cw.form:
......
......@@ -254,14 +254,14 @@ def close_form(self, form, values):
return super(formrenderers.EntityFormRenderer, self).close_form(form, values)
@monkeypatch(formrenderers.EntityFormRenderer)
@monkeypatch(formrenderers.EntityFormRenderer) # noqa: F811
def render_buttons(self, w, form):
# needed to use our own monkeypatched FormRenderer.render_buttons() which
# doesn't need to add a special case when there are 3 buttons to render
super(formrenderers.EntityFormRenderer, self).render_buttons(w, form)
@monkeypatch(formrenderers.EntityInlinedFormRenderer)
@monkeypatch(formrenderers.EntityInlinedFormRenderer) # noqa: F811
def open_form(self, w, form, values):
try:
w(u'<div id="div-%(divid)s" onclick="%(divonclick)s">' % values)
......@@ -274,12 +274,12 @@ def open_form(self, w, form, values):
w(u'<div class="iformBody">')
@monkeypatch(formrenderers.EntityInlinedFormRenderer)
@monkeypatch(formrenderers.EntityInlinedFormRenderer) # noqa: F811
def close_form(self, w, form, values):
w(u'</div></div>')
@monkeypatch(formrenderers.EntityInlinedFormRenderer)
@monkeypatch(formrenderers.EntityInlinedFormRenderer) # noqa: F811
def render_fields(self, w, form, values):
w(u'<fieldset id="fs-%(divid)s">' % values)
fields = self._render_hidden_fields(w, form)
......
......@@ -28,10 +28,11 @@ def bwcompatible_render_item(w, item):
item.render(w)
w(u'</li>')
else:
item.render(w) # XXX displays <li> by itself
item.render(w) # XXX displays <li> by itself
else:
w(u'<li>%s</li>' % item)
@monkeypatch(htmlwidgets.BoxMenu)
def _render(self):
tag = u'li' if self.isitem else u'div'
......
......@@ -23,7 +23,8 @@ __docformat__ = "restructuredtext en"
NavigationComponent.page_link_templ = u'<li><a href="%s" title="%s">%s</a></li>'
NavigationComponent.selected_page_link_templ = u'<li class="active"><a href="%s" title="%s">%s</a></li>'
NavigationComponent.previous_page_link_templ = NavigationComponent.next_page_link_templ = NavigationComponent.page_link_templ
NavigationComponent.previous_page_link_templ = NavigationComponent.page_link_templ
NavigationComponent.next_page_link_templ = NavigationComponent.page_link_templ
NavigationComponent.no_previous_page_link = u'<li class="disabled"><a href="#">«</a></li>'
NavigationComponent.no_next_page_link = u'<li class="disabled"><a href="#">»</a></li>'
NavigationComponent.no_content_prev_link = u'«'
......@@ -173,7 +174,7 @@ if not CW_323:
View.handle_pagination = False
@monkeypatch(PageNavigationSelect)
@monkeypatch(PageNavigationSelect) # noqa: F811
def call(self):
params = dict(self._cw.form)
self.clean_params(params)
......
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