Пример #1
0
def humanize_name(name, idn=False):
    if idn:
        try:
            name = name.canonicalize().to_unicode()
        except UnicodeError:
            name = name.canonicalize().to_text()
    else:
        name = name.canonicalize().to_text()
    if name == '.':
        return name
    return name.rstrip('.')
Пример #2
0
def humanize_name(name, idn=False):
    if idn:
        try:
            name = name.canonicalize().to_unicode()
        except UnicodeError:
            name = lb2s(name.canonicalize().to_text())
    else:
        name = lb2s(name.canonicalize().to_text())
    if name == '.':
        return name
    return name.rstrip('.')