From b8c46f2a32d0d8c2dc6ef0867f85f63cf076a004 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 15 Jul 2015 16:38:06 +0200 Subject: Modernize number literals Use Python-3 compatible syntax, without breaking compatibility with py 2.7 - Octals literals start with 0o to prevent confusion - The "L" at the end of large int literals is not required as they use long on Python 2 automatically. - Using 'int' instead of 'long' for small numbers is OK in all cases except strict type checking checking, e.g. type(0). https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Jan Cholasta --- ipapython/certdb.py | 10 +++++----- ipapython/certmonger.py | 4 ++-- ipapython/ipa_log_manager.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ipapython') diff --git a/ipapython/certdb.py b/ipapython/certdb.py index 5a6e494fb..e3238c846 100644 --- a/ipapython/certdb.py +++ b/ipapython/certdb.py @@ -48,12 +48,12 @@ def create_ipa_nssdb(): with open(pwdfile, 'w') as f: f.write(ipautil.ipa_generate_password(pwd_len=40)) - os.chmod(pwdfile, 0600) + os.chmod(pwdfile, 0o600) db.create_db(pwdfile) - os.chmod(os.path.join(db.secdir, 'cert8.db'), 0644) - os.chmod(os.path.join(db.secdir, 'key3.db'), 0644) - os.chmod(os.path.join(db.secdir, 'secmod.db'), 0644) + os.chmod(os.path.join(db.secdir, 'cert8.db'), 0o644) + os.chmod(os.path.join(db.secdir, 'key3.db'), 0o644) + os.chmod(os.path.join(db.secdir, 'secmod.db'), 0o644) def find_cert_from_txt(cert, start=0): @@ -420,7 +420,7 @@ class NSSDatabase(object): cert = self.get_cert(nickname) with open(location, "w+") as fd: fd.write(cert) - os.chmod(location, 0444) + os.chmod(location, 0o444) def import_pem_cert(self, nickname, flags, location): """Import a cert form the given PEM file. diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py index b37676872..3a2907d83 100644 --- a/ipapython/certmonger.py +++ b/ipapython/certmonger.py @@ -493,7 +493,7 @@ def dogtag_start_tracking(ca, nickname, pin, pinfile, secdir, pre_command, params['KEY_PIN_FILE'] = os.path.abspath(pinfile) if pre_command: if not os.path.isabs(pre_command): - if sys.maxsize > 2**32L: + if sys.maxsize > 2**32: libpath = 'lib64' else: libpath = 'lib' @@ -501,7 +501,7 @@ def dogtag_start_tracking(ca, nickname, pin, pinfile, secdir, pre_command, params['cert-presave-command'] = pre_command if post_command: if not os.path.isabs(post_command): - if sys.maxsize > 2**32L: + if sys.maxsize > 2**32: libpath = 'lib64' else: libpath = 'lib' diff --git a/ipapython/ipa_log_manager.py b/ipapython/ipa_log_manager.py index f2cd4d3a1..8d01c51a4 100644 --- a/ipapython/ipa_log_manager.py +++ b/ipapython/ipa_log_manager.py @@ -180,7 +180,7 @@ def standard_logging_setup(filename=None, verbose=False, debug=False, file_handler = dict(name='file', filename=filename, filemode=filemode, - permission=0600, + permission=0o600, level='debug', format=LOGGING_FORMAT_STANDARD_FILE) handlers.append(file_handler) -- cgit