示例#1
0
def test_decoding_drops_spaces_between_encoded_words():
    expected = u"Vill bli borttagen från hitta.se"
    actual = encoding.properly_decode_header('=?iso-8859-1?Q?Vill_bli_b?= =?iso-8859-1?Q?orttagen_f?= =?iso-8859-1?Q?r=E5n_hitta.?= =?iso-8859-1?Q?se?=')
    assert_equal(actual, expected)

    actual = encoding.properly_decode_header('Vill bli =?iso-8859-1?Q?borttagen_f?= =?iso-8859-1?Q?r=E5n_hitta.?= =?iso-8859-1?Q?se?=')
    assert_equal(actual, expected)

    actual = encoding.properly_decode_header('=?iso-8859-1?Q?Vill_bli?= borttagen =?iso-8859-1?Q?fr=E5n_hitta.?= =?iso-8859-1?Q?se?=')
    assert_equal(actual, expected)

    actual = encoding.properly_decode_header('=?iso-8859-1?Q?Vill_bli?= borttagen =?iso-8859-1?Q?fr=E5n_hitta.?= =?iso-8859-1?Q?se?= s**t')
    assert_equal(actual, u"Vill bli borttagen från hitta.se s**t")
示例#2
0
def get_group(group):
    s = nntplib.NNTP("news.epita.fr")
    _, _, first, last, _ = s.group(group)
    subjects = [(x[0], properly_decode_header(x[1]))
                for x in s.xover(first, last)[1]]
    subjects.reverse()
    return flask.render_template('subjects.html', subjects=subjects)
示例#3
0
def get_group(group):
    s = nntplib.NNTP("news.epita.fr")
    _, _, first, last, _ = s.group(group)
    subjects = [(x[0], properly_decode_header(x[1])) for
            x in s.xover(first, last)[1]]
    subjects.reverse()
    return flask.render_template('subjects.html', subjects=subjects)
示例#4
0
def get_group(group):
    s = nntplib.NNTP("news.epita.fr")
    _, _, first, last, _ = s.group(group)
    subjects = s.xhdr("subject", first + "-" + last)[1]
    subjects = [(num, properly_decode_header(title)) for
            (num, title) in subjects]
    subjects.reverse()
    return flask.render_template('subjects.html', subjects=subjects)
示例#5
0
def test_properly_decode_header():
    for i, header in enumerate(BAD_HEADERS):
        parsed = encoding.properly_decode_header(header)
        assert_equal(DECODED_HEADERS[i], parsed)
示例#6
0
def test_properly_decode_header():
    for i, header in enumerate(BAD_HEADERS):
        parsed = encoding.properly_decode_header(header)
        assert_equal(DECODED_HEADERS[i], parsed)