예제 #1
0
파일: html.py 프로젝트: vfaronov/httpolice
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
파일: html.py 프로젝트: weijl6819/httpolice
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
파일: html.py 프로젝트: garmann/httpolice
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)'