web/application.py
branchtls-sprint
changeset 882 75488a2a875e
parent 871 01eb42259154
child 1132 96752791c2b6
equal deleted inserted replaced
881:18e6c8db7bc5 882:75488a2a875e
   383             req.data['ex'] = ex
   383             req.data['ex'] = ex
   384             if tb:
   384             if tb:
   385                 req.data['excinfo'] = excinfo
   385                 req.data['excinfo'] = excinfo
   386             req.form['vid'] = 'error'
   386             req.form['vid'] = 'error'
   387             errview = self.vreg.select_view('error', req, None)
   387             errview = self.vreg.select_view('error', req, None)
   388             content = self.vreg.main_template(req, 'main-template', view=errview)
   388             template = self.main_template_id(req)
       
   389             content = self.vreg.main_template(req, template, view=errview)
   389         except:
   390         except:
   390             content = self.vreg.main_template(req, 'error-template')
   391             content = self.vreg.main_template(req, 'error-template')
   391         raise StatusResponse(500, content)
   392         raise StatusResponse(500, content)
   392     
   393     
   393     def need_login_content(self, req):
   394     def need_login_content(self, req):
   395     
   396     
   396     def loggedout_content(self, req):
   397     def loggedout_content(self, req):
   397         return self.vreg.main_template(req, 'loggedout')
   398         return self.vreg.main_template(req, 'loggedout')
   398     
   399     
   399     def notfound_content(self, req):
   400     def notfound_content(self, req):
   400         template = req.property_value('ui.main-template') or 'main-template'
       
   401         req.form['vid'] = '404'
   401         req.form['vid'] = '404'
   402         view = self.vreg.select_view('404', req, None)
   402         view = self.vreg.select_view('404', req, None)
       
   403         template = self.main_template_id(req)
   403         return self.vreg.main_template(req, template, view=view)
   404         return self.vreg.main_template(req, template, view=view)
   404 
   405 
       
   406     def main_template_id(self, req):
       
   407         template = req.property_value('ui.main-template')
       
   408         if template not in self.vreg.registry('views') :
       
   409             template = 'main-template'
       
   410         return template
       
   411         
   405 
   412 
   406 set_log_methods(CubicWebPublisher, LOGGER)
   413 set_log_methods(CubicWebPublisher, LOGGER)
   407 set_log_methods(CookieSessionHandler, LOGGER)
   414 set_log_methods(CookieSessionHandler, LOGGER)