Beispiel #1
0
    def json(cls, handler, response=""):
        request = handler.request
        if not Transaction.get_root(request):
            return ""
        TransactionNode.trim_data(request)

        result = {}
        for instance in cls.instances.values():
            panel = instance.get_json_panel(handler.request)
            result[panel['id']] = panel

        response_panel_raw = cls.get_response_raw_data(handler, response)
        response_panel_json = {'name': 'response', 'id': 'response', 'content': response_panel_raw}
        result['response'] = response_panel_json
        return json.dumps(result)
Beispiel #2
0
    def render(cls, handler, response=""):
        """
        渲染页面
        """
        request = handler.request
        if not Transaction.get_root(request):
            return ""
        TransactionNode.trim_data(request)
        panels = [instance.get_panel(request) for instance in cls.instances.values()]

        response_raw_data = cls.get_response_raw_data(handler, response)
        panels.append(cls.get_response_panel(response_raw_data))

        template = jinja_env.get_template('index.html')
        return template.render(panels=panels)
Beispiel #3
0
    def render(cls, handler, response=""):
        """
        渲染页面
        """
        request = handler.request
        if not Transaction.get_root(request):
            return ""
        TransactionNode.trim_data(request)
        panels = [
            instance.get_panel(request) for instance in cls.instances.values()
        ]

        response_raw_data = cls.get_response_raw_data(handler, response)
        panels.append(cls.get_response_panel(response_raw_data))

        template = jinja_env.get_template('index.html')
        return template.render(panels=panels)
Beispiel #4
0
    def json(cls, handler, response=""):
        request = handler.request
        if not Transaction.get_root(request):
            return ""
        TransactionNode.trim_data(request)

        result = {}
        for instance in cls.instances.values():
            panel = instance.get_json_panel(handler.request)
            result[panel['id']] = panel

        response_panel_raw = cls.get_response_raw_data(handler, response)
        response_panel_json = {
            'name': 'response',
            'id': 'response',
            'content': response_panel_raw
        }
        result['response'] = response_panel_json
        return json.dumps(result)