common/view.py
branchtls-sprint
changeset 632 3a394a90b702
parent 543 c0f2b6378f70
child 633 087e3f1e87c8
equal deleted inserted replaced
631:99f5852f8604 632:3a394a90b702
    84 
    84 
    85     At instantiation time, the standard `req`, `rset`, and `cursor`
    85     At instantiation time, the standard `req`, `rset`, and `cursor`
    86     attributes are added and the `w` attribute will be set at rendering
    86     attributes are added and the `w` attribute will be set at rendering
    87     time to a write function to use.
    87     time to a write function to use.
    88     """
    88     """
       
    89     __registerer__ = priority_registerer
    89     __registry__ = 'views'
    90     __registry__ = 'views'
    90 
    91 
    91     templatable = True
    92     templatable = True
    92     need_navigation = True
    93     need_navigation = True
    93     # content_type = 'application/xhtml+xml' # text/xhtml'
    94     # content_type = 'application/xhtml+xml' # text/xhtml'
   402                 label = translate(self.req, attr)
   403                 label = translate(self.req, attr)
   403             labels.append(label)
   404             labels.append(label)
   404         return labels
   405         return labels
   405 
   406 
   406 
   407 
   407 class EmptyRsetView(View):
       
   408     """base class for views applying on any empty result sets"""
       
   409     __registerer__ = priority_registerer
       
   410     __selectors__ = (empty_rset,)
       
   411 
       
   412 
       
   413 # concrete template base classes ##############################################
   408 # concrete template base classes ##############################################
   414 
   409 
   415 class Template(View):
   410 class Template(View):
   416     """a template is almost like a view, except that by default a template
   411     """a template is almost like a view, except that by default a template
   417     is only used globally (i.e. no result set adaptation)
   412     is only used globally (i.e. no result set adaptation)
   431 class MainTemplate(Template):
   426 class MainTemplate(Template):
   432     """main template are primary access point to render a full HTML page.
   427     """main template are primary access point to render a full HTML page.
   433     There is usually at least a regular main template and a simple fallback
   428     There is usually at least a regular main template and a simple fallback
   434     one to display error if the first one failed
   429     one to display error if the first one failed
   435     """
   430     """
   436 
       
   437     base_doctype = STRICT_DOCTYPE
   431     base_doctype = STRICT_DOCTYPE
   438 
   432 
   439     @property
   433     @property
   440     def doctype(self):
   434     def doctype(self):
   441         if self.req.xhtml_browser():
   435         if self.req.xhtml_browser():