Ignore:
Timestamp:
May 6, 2013, 9:15:41 PM (7 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Deprecate prepareIDNName.

C{unicode.encode('idna')} does exactly the same as the recently
introduced L{generic.prepareIDNName}.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/generic.py

    r178 r184  
    88"""
    99
    10 from encodings import idna
    11 
    1210from zope.interface import implements
    1311
    1412from twisted.internet import defer, protocol
    1513from twisted.python import reflect
     14from twisted.python.deprecate import deprecated
     15from twisted.python.versions import Version
    1616from twisted.words.protocols.jabber import error, jid, xmlstream
    1717from twisted.words.protocols.jabber.xmlstream import toResponse
     
    333333
    334334
     335@deprecated(Version("Wokkel", 0, 8, 0), "unicode.encode('idna')")
    335336def prepareIDNName(name):
    336337    """
     
    342343    standard full stop.
    343344    """
    344     result = []
    345     labels = idna.dots.split(name)
    346 
    347     if labels and len(labels[-1]) == 0:
    348         trailing_dot = b'.'
    349         del labels[-1]
    350     else:
    351         trailing_dot = b''
    352 
    353     for label in labels:
    354         result.append(idna.ToASCII(label))
    355 
    356     return b'.'.join(result) + trailing_dot
     345    return name.encode('idna')
Note: See TracChangeset for help on using the changeset viewer.