[PATCH sherpa] [views] Drop buggy monkey-patch on add_onload

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Aug 25 14:01:17 CEST 2017


this patch causes a flake8 error, fixed in a V2


On 25/08/2017 13:04, Sylvain Thenault wrote:
>  cubicweb_sherpa/views/templates.py |  10 ----------
>  1 files changed, 0 insertions(+), 10 deletions(-)
>
>
> # HG changeset patch
> # User Sylvain Thénault <sylvain.thenault at logilab.fr>
> # Date 1503659030 -7200
> #      Fri Aug 25 13:03:50 2017 +0200
> # Node ID e8e564147f1bce197a25d8fe5578fc946a5782b5
> # Parent  959dd18ff04429b87d01be4fafcdedb052ee2896
> # Available At https://hg.logilab.org/review/cubes/sherpa
> #              hg pull https://hg.logilab.org/review/cubes/sherpa -r e8e564147f1b
> [views] Drop buggy monkey-patch on add_onload
>
> this has been inadvertently copied from francearchive and has nasty side effect since
> it also remove a wrapper that makes the js code called once the page is fully loaded.
>
> diff --git a/cubicweb_sherpa/views/templates.py b/cubicweb_sherpa/views/templates.py
> --- a/cubicweb_sherpa/views/templates.py
> +++ b/cubicweb_sherpa/views/templates.py
> @@ -27,20 +27,10 @@ from . import jinja_render
>  
>  # Bootstrap configuration.
>  basetemplates.TheMainTemplate.twbs_container_cls = 'container-fluid'
>  
>  
> - at monkeypatch(HTMLHead)
> -def add_onload(self, jscode):
> -    """original `add_onload` implementation use `$(cw)`
> -    but `cw` variable is not available
> -    in francearchive, use `$` instead"""
> -    self.add_post_inline_script(u"""$(function() {
> -  %s
> -});""" % jscode)
> -
> -
>  def render_component(comp):
>      stream = UStringIO()
>      w = stream.write
>      comp.render(w)
>      return stream.getvalue()
>

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the saem-devel mailing list