Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
def find_reason_phrase(response):
    return response.reason or known.title(response.status) or u'(unknown)'
Пример #6
0
def find_reason_phrase(response):
    return response.reason or known.title(response.status) or u'(unknown)'