def _render_error(template, context, error): if template.error_handler: result = template.error_handler(context, error) if not result: compat.reraise(*sys.exc_info()) else: error_template = exceptions.html_error_template() if context._outputting_as_unicode: context._buffer_stack[:] = [ util.FastEncodingBuffer(as_unicode=True)] else: context._buffer_stack[:] = [util.FastEncodingBuffer( error_template.output_encoding, error_template.encoding_errors)] context._set_with_template(error_template) error_template.render_context(context, error=error)
def _render_error(template, context, error): if template.error_handler: result = template.error_handler(context, error) if not result: compat.reraise(*sys.exc_info()) else: error_template = exceptions.html_error_template() if context._outputting_as_unicode: context._buffer_stack[:] = [ util.FastEncodingBuffer(as_unicode=True)] else: context._buffer_stack[:] = [util.FastEncodingBuffer( error_template.output_encoding, error_template.encoding_errors)] context._set_with_template(error_template) error_template.render_context(context, error=error)
def _include_file(context, uri, calling_uri, **kwargs): """locate the template from the given uri and include it in the current output.""" template = _lookup_template(context, uri, calling_uri) (callable_, ctx) = _populate_self_namespace(context._clean_inheritance_tokens(), template) kwargs = _kwargs_for_include(callable_, context._data, **kwargs) if template.include_error_handler: try: callable_(ctx, **kwargs) except Exception: result = template.include_error_handler(ctx, compat.exception_as()) if not result: compat.reraise(*sys.exc_info()) else: callable_(ctx, **kwargs)
def _include_file(context, uri, calling_uri, **kwargs): """locate the template from the given uri and include it in the current output.""" template = _lookup_template(context, uri, calling_uri) (callable_, ctx) = _populate_self_namespace( context._clean_inheritance_tokens(), template) kwargs = _kwargs_for_include(callable_, context._data, **kwargs) if template.include_error_handler: try: callable_(ctx, **kwargs) except Exception: result = template.include_error_handler(ctx, compat.exception_as()) if not result: compat.reraise(*sys.exc_info()) else: callable_(ctx, **kwargs)