Beispiel #1
0
 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
Beispiel #2
0
 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
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
    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
Beispiel #7
0
    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
Beispiel #8
0
 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
Beispiel #9
0
    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)
Beispiel #10
0
    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)
Beispiel #11
0
    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
Beispiel #12
0
    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
Beispiel #13
0
    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)
Beispiel #14
0
    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)
Beispiel #15
0
    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
Beispiel #16
0
    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)
Beispiel #17
0
 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)
Beispiel #18
0
 def default(self, page, **kwargs):
     if page.endswith('.html'):
         return template.render(page, None)
     raise cherrypy.HTTPError(404)
Beispiel #19
0
 def default(self, page, **kwargs):
     if page.endswith('.html'):
         return template.render(page, None)
     raise cherrypy.HTTPError(404)
Beispiel #20
0
 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
Beispiel #21
0
 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