mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
Alias "unicode" to "str" under Python 3
The six way of doing this is to replace all occurences of "unicode" with "six.text_type". However, "unicode" is non-ambiguous and (arguably) easier to read. Also, using it makes the patches smaller, which should help with backporting. Reviewed-By: Petr Viktorin <pviktori@redhat.com>
This commit is contained in:
@@ -425,6 +425,9 @@ from ldap.dn import str2dn, dn2str
|
||||
from ldap import DECODING_ERROR
|
||||
import six
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
__all__ = 'AVA', 'RDN', 'DN'
|
||||
|
||||
def _adjust_indices(start, end, length):
|
||||
|
||||
@@ -23,6 +23,9 @@ import copy
|
||||
|
||||
import six
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class DNSName(dns.name.Name):
|
||||
|
||||
@@ -25,6 +25,7 @@ import ConfigParser
|
||||
from urllib import urlencode
|
||||
|
||||
import nss.nss as nss
|
||||
import six
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipalib.errors import NetworkError
|
||||
@@ -33,6 +34,9 @@ from ipapython import nsslib, ipautil
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython.ipa_log_manager import *
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
# IPA can use either Dogtag version 9 or 10.
|
||||
#
|
||||
# Install tools should use the constants from install_constants, so that they
|
||||
|
||||
@@ -47,6 +47,9 @@ from ipapython.ipa_log_manager import log_mgr
|
||||
from ipapython.dn import DN, RDN
|
||||
from ipapython.dnsutil import DNSName
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
# Global variable to define SASL auth
|
||||
SASL_GSSAPI = ldap.sasl.sasl({}, 'GSSAPI')
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@ import struct
|
||||
from hashlib import md5, sha1
|
||||
from hashlib import sha256 #pylint: disable=E0611
|
||||
|
||||
import six
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
__all__ = ['SSHPublicKey']
|
||||
|
||||
OPENSSH_BASE_REGEX = re.compile(r'^[\t ]*(?P<keytype>[^\x00\n\r]+?) [\t ]*(?P<key>[^\x00\n\r]+?)(?:[\t ]+(?P<comment>[^\x00\n\r]*?)[\t ]*)?$')
|
||||
|
||||
@@ -31,10 +31,15 @@ import ConfigParser
|
||||
import random
|
||||
import string
|
||||
|
||||
import six
|
||||
|
||||
from ipapython import ipautil
|
||||
from ipaplatform.tasks import tasks
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
SYSRESTORE_PATH = paths.TMP
|
||||
SYSRESTORE_INDEXFILE = "sysrestore.index"
|
||||
SYSRESTORE_STATEFILE = "sysrestore.state"
|
||||
|
||||
Reference in New Issue
Block a user