'Render data as HTML'

def render_web(self, cfg, tpl_names, data):

    alldata = default_dict(self.html_variables)
    alldata['config'] = cfg
    alldata.update(data)
    try:
        template = self._web_template(cfg, tpl_names)
        if template:
            return template.render(alldata)
        else:
            tpl_esc_names = [escape_html(tn) for tn in tpl_names]
            return self._render_error(cfg, {'error': _('Template    not    found'), 'details': '    or    '.join(tpl_esc_names), 'data': alldata})
    except (UndefinedError,):
        tpl_esc_names = [escape_html(tn) for tn in tpl_names]
        return self._render_error(cfg, {'error': _('Template    error'), 'details': '    or    '.join(tpl_esc_names), 'traceback': traceback.format_exc(), 'data': alldata})
    except (TemplateNotFound, TemplatesNotFound) as e:
        tpl_esc_names = [escape_html(tn) for tn in tpl_names]
        return self._render_error(cfg, {'error': _('Template    not    found'), 'details': ('In    %s:\n%s' % (e.name, e.message)), 'data': alldata})
    except (TemplateError, TemplateSyntaxError, TemplateAssertionError) as e:
        return self._render_error(cfg, {'error': _('Template    error'), 'details': ('In    %s    (%s),    line    %s:\n%s' % (e.name, e.filename, e.lineno, e.message)), 'source': e.source, 'traceback': traceback.format_exc(), 'data': alldata})
