# HG changeset patch # User Adrien Di Mascio # Date 1234985157 -3600 # Node ID ea092805d8f8c01d632cfa56261e00be78ba4e19 # Parent 394927376a01f04cae3756bbf6ad6c7eb9d3a865 The main template is now a simple view, there's no need to monkey patch TheMainTemplate._select_view_and_rset diff -r 394927376a01 -r ea092805d8f8 devtools/testlib.py --- a/devtools/testlib.py Wed Feb 18 20:25:12 2009 +0100 +++ b/devtools/testlib.py Wed Feb 18 20:25:57 2009 +0100 @@ -197,24 +197,16 @@ self.set_description("testing %s, mod=%s (%s)" % (vid, view.__module__, rset.printable_rql())) else: self.set_description("testing %s, mod=%s (no rset)" % (vid, view.__module__)) - viewfunc = lambda **k: self.vreg.main_template(req, template, **kwargs) if template is None: # raw view testing, no template viewfunc = view.dispatch - elif template == 'main-template': - _select_view_and_rset = TheMainTemplate._select_view_and_rset - # patch TheMainTemplate.process_rql to avoid recomputing resultset - def __select_view_and_rset(self, view=view, rset=rset): - self.rset = rset - return view, rset - TheMainTemplate._select_view_and_rset = __select_view_and_rset - try: - return self._test_view(viewfunc, view, template, **kwargs) - finally: - if template == 'main-template': - TheMainTemplate._select_view_and_rset = _select_view_and_rset + else: + templateview = self.vreg.select_view(template, req, rset, view=view, **kwargs) + kwargs['view'] = view + viewfunc = lambda **k: self.vreg.main_template(req, template, **kwargs) + return self._test_view(viewfunc, view, template, kwargs) - def _test_view(self, viewfunc, view, template='main-template', **kwargs): + def _test_view(self, viewfunc, view, template='main-template', kwargs={}): """this method does the actual call to the view If no error occured while rendering the view, the HTML is analyzed