Example #1
0
def create_app(traceback_string, monitored_files=None):
    non_site_files = _filter_site_files(monitored_files)
    parsed_tb = _ParsedTB.from_string(traceback_string)
    resources = {'tb_str': traceback_string,
                 'parsed_error': parsed_tb,
                 'all_mon_files': monitored_files,
                 'mon_files': non_site_files}
    render_fact = AshesRenderFactory()
    render_fact.register_source('flaw_tmpl', _FLAW_TEMPLATE)
    routes = [('/', get_flaw_info, 'flaw_tmpl'),
              ('/<path:_ignored>', get_flaw_info, 'flaw_tmpl')]

    app = Application(routes, resources, render_fact)
    return app
Example #2
0
    def __init__(self,
                 peripherals=None,
                 page_title=DEFAULT_PAGE_TITLE,
                 base_peripherals=DEFAULT_PERIPHERALS):
        self.page_title = page_title
        self.peripherals = list(base_peripherals)
        self.peripherals.extend(peripherals or [])

        self._arf = AshesRenderFactory(_CUR_PATH, keep_whitespace=False)
        self._main_page_render = self._arf('meta_base.html')
        routes = [('/', self.get_main, self.render_main_page_html),
                  ('/clastic_assets/', StaticApplication(_ASSET_PATH)),
                  ('/json/', self.get_main, render_json)]
        for peri in self.peripherals:
            routes.extend(peri.get_extra_routes())
        resources = {
            '_meta_start_time': datetime.datetime.utcnow(),
            'page_title': page_title
        }

        mwares = [
            ScriptRootMiddleware(),
            SimpleContextProcessor('script_root')
        ]
        super(MetaApplication, self).__init__(routes, resources, mwares)
Example #3
0
def create_app(traceback_string, monitored_files=None):
    non_site_files = _filter_site_files(monitored_files)
    try:
        parsed_tb = _ParsedTB.from_string(traceback_string)
        parsed_error = parsed_tb.to_dict()
    except:
        parsed_error = {}
    resources = {'tb_str': traceback_string,
                 'parsed_error': parsed_error,
                 'all_mon_files': monitored_files,
                 'mon_files': non_site_files}
    render_fact = AshesRenderFactory()
    render_fact.register_source('flaw_tmpl', _FLAW_TEMPLATE)
    routes = [('/', get_flaw_info, 'flaw_tmpl'),
              ('/clastic_assets/', StaticApplication(_ASSET_PATH)),
              ('/<path:_ignored>', get_flaw_info, 'flaw_tmpl')]

    app = Application(routes, resources, render_fact)
    return app
Example #4
0
 def __init__(self):
     arf = AshesRenderFactory(_CUR_PATH, keep_whitespace=False)
     self.loaded_template = arf.env.load(self.template_path)