[web/navigation] use add_onload instead of inline javascript href
This way our javascript code isn't thrown out by the html cleaner e.g. when
using the rql rest directive and a table view.
To make things simpler, we now always use ajax URLs for navigation,
even when we would previously have used regular links.
Closes #3501626
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.fromlogilab.common.testlibimportunittest_mainfromlogilab.mtconverterimporthtml_unescapefromcubicwebimportForbidden,ValidationErrorfromcubicweb.devtools.testlibimportCubicWebTCfromcubicweb.utilsimportjsonfromcubicweb.viewimportStartupView,TRANSITIONAL_DOCTYPE_NOEXTfromcubicweb.webimportRedirectfromcubicweb.web.htmlwidgetsimportTableWidgetfromcubicweb.web.viewsimportvid_from_rsetimportreimporthmacclassErrorViewTC(CubicWebTC):defsetUp(self):super(ErrorViewTC,self).setUp()self.req=self.request()self.vreg.config['submit-mail']="test@logilab.fr"self.vreg.config['print-traceback']="yes"deftest_error_generation(self):""" tests """classMyWrongView(StartupView):__regid__='my-view'defcall(self):raiseValueError('This is wrong')withself.temporary_appobjects(MyWrongView):try:self.view('my-view')exceptExceptionase:importsysself.req.data['excinfo']=sys.exc_info()self.req.data['ex']=ehtml=self.view('error',req=self.req)self.failUnless(re.search(r'^<input name="__signature" type="hidden" value="[0-9a-f]{32}" />$',html.source,re.M))deftest_error_submit_nosig(self):""" tests that the reportbug controller refuses submission if there is not content signature """self.req.form={'description':u'toto',}withself.assertRaises(Forbidden)ascm:self.ctrl_publish(self.req,'reportbug')deftest_error_submit_wrongsig(self):""" tests that the reportbug controller refuses submission if the content signature is invalid """self.req.form={'__signature':'X','description':u'toto',}withself.assertRaises(Forbidden)ascm:self.ctrl_publish(self.req,'reportbug')deftest_error_submit_ok(self):""" tests that the reportbug controller accept the email submission if the content signature is valid """sign=self.vreg.config.sign_text('toto')self.req.form={'__signature':sign,'description':u'toto',}withself.assertRaises(Redirect)ascm:self.ctrl_publish(self.req,'reportbug')if__name__=='__main__':unittest_main()