Skip to content

Commit 97fbfe1

Browse files
committed
Use python 3 compatible print statements.
1 parent 397b76b commit 97fbfe1

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

example/test_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import print_function
3+
24
from django.conf import settings
35
from django.test.simple import DjangoTestSuiteRunner
46

@@ -17,15 +19,15 @@ def run_tests(self, *args, **kwargs):
1719

1820
if run_with_coverage:
1921
coverage.stop()
20-
print ''
21-
print '----------------------------------------------------------------------'
22-
print ' Unit Test Code Coverage Results'
23-
print '----------------------------------------------------------------------'
22+
print('')
23+
print('----------------------------------------------------------------------')
24+
print(' Unit Test Code Coverage Results')
25+
print('----------------------------------------------------------------------')
2426
coverage_modules = []
2527
for module in settings.COVERAGE_MODULES:
2628
coverage_modules.append(__import__(module, globals(),
2729
locals(), ['']))
2830
coverage.report(coverage_modules, show_missing=1)
29-
print '----------------------------------------------------------------------'
31+
print('----------------------------------------------------------------------')
3032

3133
return result

feincms/management/commands/feincms_validate.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
``feincms_validate`` checks your models for common pitfalls.
99
"""
10+
from __future__ import print_function
1011

1112
from django.core.management.base import NoArgsCommand
1213
from django.core.management.color import color_style
@@ -21,7 +22,7 @@ class Command(NoArgsCommand):
2122
def handle_noargs(self, **options):
2223
self.style = color_style()
2324

24-
print "Running Django's own validation:"
25+
print("Running Django's own validation:")
2526
self.validate(display_num_errors=True)
2627

2728
for model in loading.get_models():
@@ -38,7 +39,7 @@ def validate_base_model(self, model):
3839
"""
3940

4041
if not hasattr(model, 'template'):
41-
print self.style.NOTICE('%s has no template attribute; did you forget register_templates or register_regions?' % model)
42+
print(self.style.NOTICE('%s has no template attribute; did you forget register_templates or register_regions?' % model))
4243

4344
def validate_content_type(self, model):
4445
"""
@@ -47,4 +48,4 @@ def validate_content_type(self, model):
4748

4849
for base in model.__bases__:
4950
if not base._meta.abstract:
50-
print self.style.NOTICE('One of %s bases, %s, is not abstract' % (model, base))
51+
print(self.style.NOTICE('One of %s bases, %s, is not abstract' % (model, base)))

feincms/management/commands/medialibrary_orphans.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import print_function
2+
13
import os
24

35
from django.core.management.base import NoArgsCommand
@@ -17,4 +19,4 @@ def handle_noargs(self, **options):
1719
for f in files:
1820
full = os.path.join(base[6:], f)
1921
if force_text(full) not in mediafiles:
20-
print os.path.join(base, f)
22+
print(os.path.join(base, f))

feincms/management/commands/rebuild_mptt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
``rebuild_mptt`` rebuilds your mptt pointers. Only use in emergencies.
99
"""
10+
from __future__ import print_function
1011

1112
from django.core.management.base import NoArgsCommand
1213

@@ -17,5 +18,5 @@ class Command(NoArgsCommand):
1718
help = "Run this manually to rebuild your mptt pointers. Only use in emergencies."
1819

1920
def handle_noargs(self, **options):
20-
print "Rebuilding MPTT pointers for Page"
21+
print("Rebuilding MPTT pointers for Page")
2122
Page._tree_manager.rebuild()

feincms/module/page/processors.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import print_function
2+
13
import re
24
import sys
35

@@ -152,18 +154,18 @@ def processor(page, request, response):
152154
pass
153155

154156
if verbose:
155-
print >> file, "--------------------------------------------------------------"
157+
print("--------------------------------------------------------------", file=file)
156158
time = 0.0
157159
i = 0
158160
for q in connection.queries:
159161
i += 1
160162
if verbose:
161-
print >> file, "%d : [%s]\n%s\n" % (
162-
i, q['time'], print_sql(q['sql']))
163+
print("%d : [%s]\n%s\n" % (
164+
i, q['time'], print_sql(q['sql'])), file=file)
163165
time += float(q['time'])
164166

165-
print >> file, "--------------------------------------------------------------"
166-
print >> file, "Total: %d queries, %.3f ms" % (i, time)
167-
print >> file, "--------------------------------------------------------------"
167+
print("--------------------------------------------------------------", file=file)
168+
print("Total: %d queries, %.3f ms" % (i, time), file=file)
169+
print("--------------------------------------------------------------", file=file)
168170

169171
return processor

0 commit comments

Comments
 (0)