summaryrefslogtreecommitdiffstats
path: root/ipaserver/advise
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-08-12 13:44:11 +0200
committerJan Cholasta <jcholast@redhat.com>2015-09-01 11:42:01 +0200
commit8de13bd7dd76f5f5b23d6e4fb84be1a2f1dc5c5e (patch)
treeac6435b79d3e540e907bcc88e3b1c534c2945626 /ipaserver/advise
parentfb7943dab454f358316160b4baf99075603a162d (diff)
downloadfreeipa-8de13bd7dd76f5f5b23d6e4fb84be1a2f1dc5c5e.tar.gz
freeipa-8de13bd7dd76f5f5b23d6e4fb84be1a2f1dc5c5e.tar.xz
freeipa-8de13bd7dd76f5f5b23d6e4fb84be1a2f1dc5c5e.zip
Use the print function
In Python 3, `print` is no longer a statement. Call it as a function everywhere, and include the future import to remove the statement in Python 2 code as well. Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaserver/advise')
-rw-r--r--ipaserver/advise/base.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/ipaserver/advise/base.py b/ipaserver/advise/base.py
index 467203f54..f7f2ad821 100644
--- a/ipaserver/advise/base.py
+++ b/ipaserver/advise/base.py
@@ -17,12 +17,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from __future__ import print_function
+
import os
+from textwrap import wrap
+
from ipalib import api
from ipalib.plugable import Plugin, API
from ipalib.errors import ValidationError
from ipapython import admintool
-from textwrap import wrap
from ipapython.ipa_log_manager import log_mgr
@@ -174,11 +177,11 @@ class IpaAdvise(admintool.AdminTool):
wrapped_description = wrap(description, 80 - len(prefix))
# Print the first line with the prefix (keyword)
- print prefix + wrapped_description[0]
+ print(prefix + wrapped_description[0])
# Print the rest wrapped behind the colon
for line in wrapped_description[1:]:
- print "{off}{line}".format(off=' ' * len(prefix), line=line)
+ print("{off}{line}".format(off=' ' * len(prefix), line=line))
def print_header(self, header, print_shell=False):
header_size = len(header)
@@ -186,14 +189,14 @@ class IpaAdvise(admintool.AdminTool):
prefix = ''
if print_shell:
prefix = '# '
- print '#!/bin/sh'
+ print('#!/bin/sh')
# Do not print out empty header
if header_size > 0:
- print(prefix + '-' * 70)
+ print((prefix + '-' * 70))
for line in wrap(header, 70):
- print(prefix + line)
- print(prefix + '-' * 70)
+ print((prefix + line))
+ print((prefix + '-' * 70))
def print_advice(self, keyword):
advice = getattr(advise_api.Advice, keyword, None)
@@ -224,7 +227,7 @@ class IpaAdvise(admintool.AdminTool):
advice.get_info()
api.Backend.rpcclient.disconnect()
for line in advice.log.content:
- print line
+ print(line)
def run(self):
super(IpaAdvise, self).run()