diff -r 5f7363416765 -r ad78b118b124 utils.py --- a/utils.py Tue Mar 09 11:00:48 2010 +0100 +++ b/utils.py Tue Mar 09 11:01:44 2010 +0100 @@ -12,10 +12,13 @@ import datetime import random from uuid import uuid4 +from warnings import warn from logilab.mtconverter import xml_escape from logilab.common.deprecation import deprecated +_MARKER = object() + # initialize random seed from current time random.seed() @@ -149,15 +152,13 @@ def add_post_inline_script(self, content): self.post_inlined_scripts.append(content) - def add_onload(self, jscode, jsoncall=False): - if jsoncall: - self.add_post_inline_script(u"""jQuery(CubicWeb).bind('ajax-loaded', function(event) { + def add_onload(self, jscode, jsoncall=_MARKER): + if jsoncall is not _MARKER: + warn('[3.7] specifying jsoncall is not needed anymore', + DeprecationWarning, stacklevel=2) + self.add_post_inline_script(u"""jQuery(CubicWeb).one('server-response', function(event) { %s });""" % jscode) - else: - self.add_post_inline_script(u"""jQuery(document).ready(function () { - %s - });""" % jscode) def add_js(self, jsfile):