Esempio n. 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
Esempio n. 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
Esempio n. 3
0
File: root.py Progetto: k0da/kimchi
 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 6
0
File: root.py Progetto: k0da/kimchi
    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
Esempio n. 7
0
File: root.py Progetto: k0da/kimchi
    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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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
Esempio n. 13
0
File: root.py Progetto: k0da/kimchi
    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)
Esempio n. 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)
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 18
0
 def default(self, page, **kwargs):
     if page.endswith('.html'):
         return template.render(page, None)
     raise cherrypy.HTTPError(404)
Esempio n. 19
0
 def default(self, page, **kwargs):
     if page.endswith('.html'):
         return template.render(page, None)
     raise cherrypy.HTTPError(404)
Esempio n. 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
Esempio n. 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