devtools/testlib.py
changeset 535 ad9ac2169089
parent 534 1368c80276bc
child 549 cd2bdcc16430
equal deleted inserted replaced
534:1368c80276bc 535:ad9ac2169089
   204         if template is None: # raw view testing, no template
   204         if template is None: # raw view testing, no template
   205             viewfunc = view.dispatch
   205             viewfunc = view.dispatch
   206         elif template == 'main':
   206         elif template == 'main':
   207             _select_view_and_rset = TheMainTemplate._select_view_and_rset
   207             _select_view_and_rset = TheMainTemplate._select_view_and_rset
   208             # patch TheMainTemplate.process_rql to avoid recomputing resultset
   208             # patch TheMainTemplate.process_rql to avoid recomputing resultset
   209             TheMainTemplate._select_view_and_rset = lambda *a, **k: (view, rset)
   209             def __select_view_and_rset(self, view=view, rset=rset):
       
   210                 self.rset = rset
       
   211                 return view, rset
       
   212             TheMainTemplate._select_view_and_rset = __select_view_and_rset
   210         try:
   213         try:
   211             return self._test_view(viewfunc, view, template, **kwargs)
   214             return self._test_view(viewfunc, view, template, **kwargs)
   212         finally:
   215         finally:
   213             if template == 'main':
   216             if template == 'main':
   214                 TheMainTemplate._select_view_and_rset = _select_view_and_rset
   217                 TheMainTemplate._select_view_and_rset = _select_view_and_rset