def _render_known(obj): """Render an instance of one of the :data:`httpolice.known.classes`.""" text = printable(str(obj)) cite = known.citation(obj) if cite: with H.a(text, href=cite.url): title = known.title(obj, with_citation=True) if title: H.attr(title=title) else: text_node(text)
def _render_known(obj): cls = type(obj).__name__ text = printable(six.text_type(obj)) cite = known.citation(obj) if cite: elem = H.a(text, _class=cls, href=cite.url, target=u'_blank') else: elem = H.span(text, _class=cls) title = known.title(obj, with_citation=True) if title: with elem: H.attr(title=title)
def _render_known(obj): """Render an instance of one of the :data:`httpolice.known.classes`.""" cls = type(obj).__name__ text = printable(six.text_type(obj)) cite = known.citation(obj) if cite: elem = H.a(text, _class=cls, href=cite.url, target=u'_blank') else: elem = H.span(text, _class=cls) title = known.title(obj, with_citation=True) if title: with elem: H.attr(title=title)
def find_reason_phrase(response): return response.reason or known.title(response.status) or u'(unknown)'