def error_development_handler(self, status, message, traceback, version): data = {'code': status, 'reason': message, 'call_stack': cherrypy._cperror.format_exc()} res = template.render('error.html', data) if type(res) is unicode: res = res.encode("utf-8") return res
def error_production_handler(self, status, message, traceback, version): data = {'code': status, 'reason': message} res = template.render('error.html', data) if (type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')): res = res.encode("utf-8") return res
def default(self, page, **kwargs): if page.endswith(".html"): return template.render(page, kwargs) if page.endswith(".json"): cherrypy.response.headers["Content-Type"] = "application/json;charset=utf-8" context = template.render_cheetah_file(page, None) return context.encode("utf-8") raise cherrypy.HTTPError(404)
def swupdate(self): validate_method(('POST')) try: task = self.model.host_swupdate() cherrypy.response.status = 202 return render("Task", task) except OperationFailed, e: raise cherrypy.HTTPError(500, e.message)
def default(self, page, **kwargs): if page.endswith('.html'): return template.render(page, kwargs) if page.endswith('.json'): cherrypy.response.headers['Content-Type'] = \ 'application/json;charset=utf-8' context = template.render_cheetah_file(page, None) return context.encode("utf-8") raise cherrypy.HTTPError(404)
def error_development_handler(self, status, message, traceback, version): self._set_CSP() data = {"code": status, "reason": message, "call_stack": cherrypy._cperror.format_exc()} res = template.render("error.html", data) if type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion("3.2.5"): res = res.encode("utf-8") return res
def error_production_handler(self, status, message, traceback, version): self._set_CSP() data = {"code": status, "reason": message} res = template.render("error.html", data) if type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion("3.2.5"): res = res.encode("utf-8") return res
def error_development_handler(self, status, message, traceback, version): data = { 'code': status, 'reason': message, 'call_stack': cherrypy._cperror.format_exc() } res = template.render('error.html', data) if type(res) is unicode: res = res.encode("utf-8") return res
def tabs(self, page, **kwargs): # In order to load the Guests tab, we also use Cheetah in the tab # template to save the delay of the extra get to the guest page # For that, the tab template needs to know the correct path to ui files data = {} data['ui_dir'] = paths.ui_dir if page.endswith('.html'): return template.render('tabs/' + page, data) raise cherrypy.HTTPError(404)
def error_production_handler(self, status, message, traceback, version): self._set_CSP() data = {'code': status, 'reason': message} res = template.render('error.html', data) if (type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')): res = res.encode("utf-8") return res
def error_development_handler(self, status, message, traceback, version): self._set_CSP() data = {'code': status, 'reason': message, 'call_stack': cherrypy._cperror.format_exc()} res = template.render('error.html', data) if (type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')): res = res.encode("utf-8") return res
def tabs(self, page, **kwargs): # In order to load the Guests tab, we also use Cheetah in the tab # template to save the delay of the extra get to the guest page # For that, the tab template needs to know the correct path to ui files data = {} data["ui_dir"] = paths.ui_dir if page.endswith(".html"): context = template.render("tabs/" + page, data) cherrypy.response.cookie["lastPage"] = "/#tabs/" + page.rstrip(".html") cherrypy.response.cookie["lastPage"]["path"] = "/" return context raise cherrypy.HTTPError(404)
def tabs(self, page, **kwargs): # In order to load the Guests tab, we also use Cheetah in the tab # template to save the delay of the extra get to the guest page # For that, the tab template needs to know the correct path to ui files data = {} data['ui_dir'] = paths.ui_dir if page.endswith('.html'): context = template.render('tabs/' + page, data) cherrypy.response.cookie["lastPage"] = "/#tabs/" + page[:-5] cherrypy.response.cookie['lastPage']['path'] = '/' return context raise cherrypy.HTTPError(404)
def error_development_handler(self, status, message, traceback, version): self._set_CSP() data = { 'code': status, 'reason': message, 'call_stack': cherrypy._cperror.format_exc() } res = template.render('error.html', data) if (type(res) is unicode and LooseVersion(cherrypy.__version__) < LooseVersion('3.2.5')): res = res.encode("utf-8") return res
def tabs(self, page, **kwargs): # In order to load the Guests tab, we also use Cheetah in the tab # template to save the delay of the extra get to the guest page # For that, the tab template needs to know the correct path to ui files data = {} data['ui_dir'] = paths.ui_dir if page.endswith('.html'): context = template.render('tabs/' + page, data) cherrypy.response.cookie[ "lastPage"] = "/#tabs/" + page[:-5] cherrypy.response.cookie['lastPage']['path'] = '/' return context raise cherrypy.HTTPError(404)
def get(self, filter_params): res_list = [] get_list = getattr(self.model, model_fn(self, 'get_list')) res_list = get_list(*self.model_args, **filter_params) return render(get_class_name(self), res_list)
def default(self, page, **kwargs): if page.endswith('.html'): return template.render(page, None) raise cherrypy.HTTPError(404)
def error_production_handler(self, status, message, traceback, version): data = {'code': status, 'reason': message} res = template.render('error.html', data) if type(res) is unicode: res = res.encode("utf-8") return res