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

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Aug 25 14:00:39 CEST 2017


 cubicweb_sherpa/views/templates.py |  14 +-------------
 1 files changed, 1 insertions(+), 13 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 9f380df8b72e7106a49d80ec26234c3a69683e2c
# Parent  959dd18ff04429b87d01be4fafcdedb052ee2896
# Available At https://hg.logilab.org/review/cubes/sherpa
#              hg pull https://hg.logilab.org/review/cubes/sherpa -r 9f380df8b72e
[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
@@ -14,33 +14,21 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 """sherpa views/templates"""
 
-from logilab.common.decorators import monkeypatch
-
 from cubicweb import NotAnEntity
-from cubicweb.utils import HTMLHead, UStringIO
+from cubicweb.utils import UStringIO
 from cubicweb.web.views import basetemplates
 
 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()


More information about the saem-devel mailing list