web/views/basetemplates.py
branchtls-sprint
changeset 828 394927376a01
parent 826 51cb3d85c059
child 832 8e06873d80d3
equal deleted inserted replaced
827:3f08481e6e51 828:394927376a01
    73         return 0
    73         return 0
    74     if req.form.has_key('__notemplate'):
    74     if req.form.has_key('__notemplate'):
    75         return 0
    75         return 0
    76     return view.templatable
    76     return view.templatable
    77 
    77 
    78 @objectify_selector
       
    79 def non_templatable_view(cls, req, rset, *args, **kwargs):
       
    80     return not templatable_view()(cls, req, rset, *args, **kwargs)
       
    81 
       
    82 
    78 
    83 class NonTemplatableViewTemplate(MainTemplate):
    79 class NonTemplatableViewTemplate(MainTemplate):
    84     """main template for any non templatable views (xml, binaries, etc.)"""
    80     """main template for any non templatable views (xml, binaries, etc.)"""
    85     id = 'main-template'
    81     id = 'main-template'
    86     __select__ = non_templatable_view()
    82     __select__ = ~ templatable_view()
    87     
    83     
    88     def call(self, view):
    84     def call(self, view):
    89         view.set_request_content_type()
    85         view.set_request_content_type()
    90         self.set_stream(templatable=False)
    86         self.set_stream(templatable=False)
    91         # have to replace our unicode stream using view's binary stream
    87         # have to replace our unicode stream using view's binary stream