web/views/basetemplates.py
changeset 597 f8c1f8a40749
parent 596 5ecf67090c2f
child 609 08b82027edf8
equal deleted inserted replaced
596:5ecf67090c2f 597:f8c1f8a40749
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
    10 from StringIO import StringIO
       
    11 
    10 
    12 from logilab.mtconverter import html_escape
    11 from logilab.mtconverter import html_escape
    13 
    12 
    14 from cubicweb import NoSelectableObject, ObjectNotFound
    13 from cubicweb import NoSelectableObject, ObjectNotFound
    15 from cubicweb.common.view import Template, MainTemplate,  NOINDEX, NOFOLLOW
    14 from cubicweb.common.view import Template, MainTemplate,  NOINDEX, NOFOLLOW
    16 from cubicweb.common.utils import make_uid
    15 from cubicweb.common.utils import make_uid
       
    16 from cubicweb.common.utils import UStringIO
    17 
    17 
    18 from cubicweb.web.views.baseviews import vid_from_rset
    18 from cubicweb.web.views.baseviews import vid_from_rset
    19 
    19 
    20 # main templates ##############################################################
    20 # main templates ##############################################################
    21 
    21 
    73     - call header / footer templates
    73     - call header / footer templates
    74     - build result set
    74     - build result set
    75     - guess and call an appropriate view through the view manager
    75     - guess and call an appropriate view through the view manager
    76     """
    76     """
    77     id = 'main'
    77     id = 'main'
       
    78     nav_html = UStringIO()
    78 
    79 
    79     def _select_view_and_rset(self):
    80     def _select_view_and_rset(self):
    80         req = self.req
    81         req = self.req
    81         if self.rset is None and not hasattr(req, '_rql_processed'):
    82         if self.rset is None and not hasattr(req, '_rql_processed'):
    82             req._rql_processed = True
    83             req._rql_processed = True
   114         return view, rset
   115         return view, rset
   115     
   116     
   116     def call(self):
   117     def call(self):
   117         view, rset = self._select_view_and_rset()
   118         view, rset = self._select_view_and_rset()
   118         req = self.req
   119         req = self.req
   119         self.nav_html = StringIO()
       
   120         # update breadcrumps **before** validating cache, unless the view
   120         # update breadcrumps **before** validating cache, unless the view
   121         # specifies explicitly it should not be added to breadcrumb or the
   121         # specifies explicitly it should not be added to breadcrumb or the
   122         # view is a binary view
   122         # view is a binary view
   123         if view.add_to_breadcrumbs and not view.binary:
   123         if view.add_to_breadcrumbs and not view.binary:
   124             req.update_breadcrumbs()
   124             req.update_breadcrumbs()