Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replaced print statement by print function (forward compatibility syn…

…tax).
  • Loading branch information...
commit 596cb9c7e287abbb98c64974fb4944d522cb6b5a 1 parent fe43ad5
Claude Paroz authored

Showing 61 changed files with 310 additions and 310 deletions. Show diff stats Hide diff stats

  1. 2  django/bin/profiling/gather_profile_stats.py
  2. 2  django/bin/unique-messages.py
  3. 2  django/contrib/auth/management/__init__.py
  4. 6  django/contrib/contenttypes/management.py
  5. 2  django/contrib/gis/db/backends/spatialite/creation.py
  6. 16  django/contrib/gis/gdal/geometries.py
  7. 24  django/contrib/gis/gdal/srs.py
  8. 4  django/contrib/gis/gdal/tests/test_ds.py
  9. 4  django/contrib/gis/gdal/tests/test_geom.py
  10. 12  django/contrib/gis/geos/tests/test_geos.py
  11. 18  django/contrib/gis/utils/ogrinfo.py
  12. 4  django/contrib/gis/utils/ogrinspect.py
  13. 4  django/contrib/sites/management.py
  14. 4  django/core/management/__init__.py
  15. 2  django/core/management/sql.py
  16. 16  django/core/servers/fastcgi.py
  17. 14  django/db/backends/creation.py
  18. 28  django/db/backends/oracle/creation.py
  19. 4  django/db/backends/sqlite3/creation.py
  20. 6  django/dispatch/saferef.py
  21. 48  django/test/_doctest.py
  22. 2  django/utils/dateformat.py
  23. 10  django/utils/termcolors.py
  24. 4  django/utils/unittest/main.py
  25. 6  docs/_ext/applyxrefs.py
  26. 10  docs/_ext/literals_to_xrefs.py
  27. 2  docs/howto/custom-model-fields.txt
  28. 2  docs/intro/install.txt
  29. 2  docs/ref/contrib/gis/db-api.txt
  30. 24  docs/ref/contrib/gis/gdal.txt
  31. 16  docs/ref/contrib/gis/geoquerysets.txt
  32. 2  docs/ref/contrib/gis/geos.txt
  33. 8  docs/ref/contrib/gis/layermapping.txt
  34. 22  docs/ref/contrib/gis/measure.txt
  35. 24  docs/ref/contrib/gis/tutorial.txt
  36. 2  docs/ref/contrib/syndication.txt
  37. 68  docs/ref/forms/api.txt
  38. 14  docs/ref/forms/fields.txt
  39. 2  docs/ref/models/instances.txt
  40. 6  docs/ref/models/querysets.txt
  41. 6  docs/ref/template-response.txt
  42. 2  docs/ref/templates/api.txt
  43. 6  docs/topics/auth.txt
  44. 4  docs/topics/db/examples/many_to_many.txt
  45. 20  docs/topics/db/queries.txt
  46. 8  docs/topics/db/sql.txt
  47. 16  docs/topics/forms/formsets.txt
  48. 16  docs/topics/forms/media.txt
  49. 4  docs/topics/forms/modelforms.txt
  50. 2  docs/topics/http/urls.txt
  51. 2  docs/topics/i18n/translation.txt
  52. 2  docs/topics/install.txt
  53. 4  docs/topics/signals.txt
  54. 2  docs/topics/signing.txt
  55. 32  extras/csrf_migration_helper.py
  56. 2  tests/regressiontests/admin_scripts/management/commands/app_command.py
  57. 2  tests/regressiontests/admin_scripts/management/commands/base_command.py
  58. 2  tests/regressiontests/admin_scripts/management/commands/label_command.py
  59. 2  tests/regressiontests/admin_scripts/management/commands/noargs_command.py
  60. 2  tests/regressiontests/test_runner/tests.py
  61. 36  tests/runtests.py
2  django/bin/profiling/gather_profile_stats.py
@@ -24,7 +24,7 @@ def gather_stats(p):
24 24
             prof = stats.load(os.path.join(p, f))
25 25
         else:
26 26
             continue
27  
-        print "Processing %s" % f
  27
+        print("Processing %s" % f)
28 28
         if path in profiles:
29 29
             profiles[path].add(prof)
30 30
         else:
2  django/bin/unique-messages.py
@@ -11,7 +11,7 @@ def unique_messages():
11 11
     elif os.path.isdir('locale'):
12 12
         basedir = os.path.abspath('locale')
13 13
     else:
14  
-        print "This script should be run from the Django Git tree or your project or app tree."
  14
+        print("This script should be run from the Django Git tree or your project or app tree.")
15 15
         sys.exit(1)
16 16
 
17 17
     for (dirpath, dirnames, filenames) in os.walk(basedir):
2  django/contrib/auth/management/__init__.py
@@ -54,7 +54,7 @@ def create_permissions(app, created_models, verbosity, **kwargs):
54 54
     auth_app.Permission.objects.bulk_create(objs)
55 55
     if verbosity >= 2:
56 56
         for obj in objs:
57  
-            print "Adding permission '%s'" % obj
  57
+            print("Adding permission '%s'" % obj)
58 58
 
59 59
 
60 60
 def create_superuser(app, created_models, verbosity, db, **kwargs):
6  django/contrib/contenttypes/management.py
@@ -39,7 +39,7 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
39 39
     ])
40 40
     if verbosity >= 2:
41 41
         for ct in cts:
42  
-            print "Adding content type '%s | %s'" % (ct.app_label, ct.model)
  42
+            print("Adding content type '%s | %s'" % (ct.app_label, ct.model))
43 43
 
44 44
     # Confirm that the content type is stale before deletion.
45 45
     if to_remove:
@@ -63,11 +63,11 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs):
63 63
         if ok_to_delete == 'yes':
64 64
             for ct in to_remove:
65 65
                 if verbosity >= 2:
66  
-                    print "Deleting stale content type '%s | %s'" % (ct.app_label, ct.model)
  66
+                    print("Deleting stale content type '%s | %s'" % (ct.app_label, ct.model))
67 67
                 ct.delete()
68 68
         else:
69 69
             if verbosity >= 2:
70  
-                print "Stale content types remain."
  70
+                print("Stale content types remain.")
71 71
 
72 72
 def update_all_contenttypes(verbosity=2, **kwargs):
73 73
     for app in get_apps():
2  django/contrib/gis/db/backends/spatialite/creation.py
@@ -24,7 +24,7 @@ def create_test_db(self, verbosity=1, autoclobber=False):
24 24
             test_db_repr = ''
25 25
             if verbosity >= 2:
26 26
                 test_db_repr = " ('%s')" % test_database_name
27  
-            print "Creating test database for alias '%s'%s..." % (self.connection.alias, test_db_repr)
  27
+            print("Creating test database for alias '%s'%s..." % (self.connection.alias, test_db_repr))
28 28
 
29 29
         self._create_test_db(verbosity, autoclobber)
30 30
 
16  django/contrib/gis/gdal/geometries.py
@@ -13,21 +13,21 @@
13 13
   >>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
14 14
   >>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
15 15
   >>> pnt = OGRGeometry(wkt1)
16  
-  >>> print pnt
  16
+  >>> print(pnt)
17 17
   POINT (-90 30)
18 18
   >>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
19 19
   >>> mpnt.add(wkt1)
20 20
   >>> mpnt.add(wkt1)
21  
-  >>> print mpnt
  21
+  >>> print(mpnt)
22 22
   MULTIPOINT (-90 30,-90 30)
23  
-  >>> print mpnt.srs.name
  23
+  >>> print(mpnt.srs.name)
24 24
   WGS 84
25  
-  >>> print mpnt.srs.proj
  25
+  >>> print(mpnt.srs.proj)
26 26
   +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
27 27
   >>> mpnt.transform_to(SpatialReference('NAD27'))
28  
-  >>> print mpnt.proj
  28
+  >>> print(mpnt.proj)
29 29
   +proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
30  
-  >>> print mpnt
  30
+  >>> print(mpnt)
31 31
   MULTIPOINT (-89.999930378602485 29.999797886557641,-89.999930378602485 29.999797886557641)
32 32
 
33 33
   The OGRGeomType class is to make it easy to specify an OGR geometry type:
@@ -35,8 +35,8 @@
35 35
   >>> gt1 = OGRGeomType(3) # Using an integer for the type
36 36
   >>> gt2 = OGRGeomType('Polygon') # Using a string
37 37
   >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
38  
-  >>> print gt1 == 3, gt1 == 'Polygon' # Equivalence works w/non-OGRGeomType objects
39  
-  True
  38
+  >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
  39
+  True True
40 40
 """
41 41
 # Python library requisites.
42 42
 import sys
24  django/contrib/gis/gdal/srs.py
@@ -4,7 +4,7 @@
4 4
   Example:
5 5
   >>> from django.contrib.gis.gdal import SpatialReference
6 6
   >>> srs = SpatialReference('WGS84')
7  
-  >>> print srs
  7
+  >>> print(srs)
8 8
   GEOGCS["WGS 84",
9 9
       DATUM["WGS_1984",
10 10
           SPHEROID["WGS 84",6378137,298.257223563,
@@ -16,14 +16,14 @@
16 16
       UNIT["degree",0.01745329251994328,
17 17
           AUTHORITY["EPSG","9122"]],
18 18
       AUTHORITY["EPSG","4326"]]
19  
-  >>> print srs.proj
  19
+  >>> print(srs.proj)
20 20
   +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
21  
-  >>> print srs.ellipsoid
  21
+  >>> print(srs.ellipsoid)
22 22
   (6378137.0, 6356752.3142451793, 298.25722356300003)
23  
-  >>> print srs.projected, srs.geographic
  23
+  >>> print(srs.projected, srs.geographic)
24 24
   False True
25 25
   >>> srs.import_epsg(32140)
26  
-  >>> print srs.name
  26
+  >>> print(srs.name)
27 27
   NAD83 / Texas South Central
28 28
 """
29 29
 from ctypes import byref, c_char_p, c_int
@@ -103,19 +103,19 @@ def __getitem__(self, target):
103 103
 
104 104
         >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
105 105
         >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
106  
-        >>> print srs['GEOGCS']
  106
+        >>> print(srs['GEOGCS'])
107 107
         WGS 84
108  
-        >>> print srs['DATUM']
  108
+        >>> print(srs['DATUM'])
109 109
         WGS_1984
110  
-        >>> print srs['AUTHORITY']
  110
+        >>> print(srs['AUTHORITY'])
111 111
         EPSG
112  
-        >>> print srs['AUTHORITY', 1] # The authority value
  112
+        >>> print(srs['AUTHORITY', 1]) # The authority value
113 113
         4326
114  
-        >>> print srs['TOWGS84', 4] # the fourth value in this wkt
  114
+        >>> print(srs['TOWGS84', 4]) # the fourth value in this wkt
115 115
         0
116  
-        >>> print srs['UNIT|AUTHORITY'] # For the units authority, have to use the pipe symbole.
  116
+        >>> print(srs['UNIT|AUTHORITY']) # For the units authority, have to use the pipe symbole.
117 117
         EPSG
118  
-        >>> print srs['UNIT|AUTHORITY', 1] # The authority value for the untis
  118
+        >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the untis
119 119
         9122
120 120
         """
121 121
         if isinstance(target, tuple):
4  django/contrib/gis/gdal/tests/test_ds.py
@@ -59,7 +59,7 @@ def test02_invalid_shp(self):
59 59
 
60 60
     def test03a_layers(self):
61 61
         "Testing Data Source Layers."
62  
-        print "\nBEGIN - expecting out of range feature id error; safe to ignore.\n"
  62
+        print("\nBEGIN - expecting out of range feature id error; safe to ignore.\n")
63 63
         for source in ds_list:
64 64
             ds = DataSource(source.ds)
65 65
 
@@ -108,7 +108,7 @@ def test03a_layers(self):
108 108
                         # the feature values here while in this loop.
109 109
                         for fld_name in fld_names:
110 110
                             self.assertEqual(source.field_values[fld_name][i], feat.get(fld_name))
111  
-        print "\nEND - expecting out of range feature id error; safe to ignore."
  111
+        print("\nEND - expecting out of range feature id error; safe to ignore.")
112 112
 
113 113
     def test03b_layer_slice(self):
114 114
         "Test indexing and slicing on Layers."
4  django/contrib/gis/gdal/tests/test_geom.py
@@ -234,7 +234,7 @@ def test07b_closepolygons(self):
234 234
         # Both rings in this geometry are not closed.
235 235
         poly = OGRGeometry('POLYGON((0 0, 5 0, 5 5, 0 5), (1 1, 2 1, 2 2, 2 1))')
236 236
         self.assertEqual(8, poly.point_count)
237  
-        print "\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n"
  237
+        print("\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n")
238 238
         try:
239 239
             c = poly.centroid
240 240
         except OGRException:
@@ -242,7 +242,7 @@ def test07b_closepolygons(self):
242 242
             pass
243 243
         else:
244 244
             self.fail('Should have raised an OGRException!')
245  
-        print "\nEND - expecting IllegalArgumentException; safe to ignore.\n"
  245
+        print("\nEND - expecting IllegalArgumentException; safe to ignore.\n")
246 246
 
247 247
         # Closing the rings -- doesn't work on GDAL versions 1.4.1 and below:
248 248
         # http://trac.osgeo.org/gdal/ticket/1673
12  django/contrib/gis/geos/tests/test_geos.py
@@ -134,7 +134,7 @@ def test01c_kml(self):
134 134
     def test01d_errors(self):
135 135
         "Testing the Error handlers."
136 136
         # string-based
137  
-        print "\nBEGIN - expecting GEOS_ERROR; safe to ignore.\n"
  137
+        print("\nBEGIN - expecting GEOS_ERROR; safe to ignore.\n")
138 138
         for err in self.geometries.errors:
139 139
             try:
140 140
                 g = fromstr(err.wkt)
@@ -144,7 +144,7 @@ def test01d_errors(self):
144 144
         # Bad WKB
145 145
         self.assertRaises(GEOSException, GEOSGeometry, buffer('0'))
146 146
 
147  
-        print "\nEND - expecting GEOS_ERROR; safe to ignore.\n"
  147
+        print("\nEND - expecting GEOS_ERROR; safe to ignore.\n")
148 148
 
149 149
         class NotAGeometry(object):
150 150
             pass
@@ -439,7 +439,7 @@ def test05a_polygons(self):
439 439
 
440 440
     def test05b_multipolygons(self):
441 441
         "Testing MultiPolygon objects."
442  
-        print "\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n"
  442
+        print("\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n")
443 443
         prev = fromstr('POINT (0 0)')
444 444
         for mp in self.geometries.multipolygons:
445 445
             mpoly = fromstr(mp.wkt)
@@ -458,7 +458,7 @@ def test05b_multipolygons(self):
458 458
                     self.assertEqual(p.valid, True)
459 459
                 self.assertEqual(mpoly.wkt, MultiPolygon(*tuple(poly.clone() for poly in mpoly)).wkt)
460 460
 
461  
-        print "\nEND - expecting GEOS_NOTICE; safe to ignore.\n"
  461
+        print("\nEND - expecting GEOS_NOTICE; safe to ignore.\n")
462 462
 
463 463
     def test06a_memory_hijinks(self):
464 464
         "Testing Geometry __del__() on rings and polygons."
@@ -995,7 +995,7 @@ def test27_valid_reason(self):
995 995
         self.assertTrue(isinstance(g.valid_reason, basestring))
996 996
         self.assertEqual(g.valid_reason, "Valid Geometry")
997 997
 
998  
-        print "\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n"
  998
+        print("\nBEGIN - expecting GEOS_NOTICE; safe to ignore.\n")
999 999
 
1000 1000
         g = GEOSGeometry("LINESTRING(0 0, 0 0)")
1001 1001
 
@@ -1003,7 +1003,7 @@ def test27_valid_reason(self):
1003 1003
         self.assertTrue(isinstance(g.valid_reason, basestring))
1004 1004
         self.assertTrue(g.valid_reason.startswith("Too few points in geometry component"))
1005 1005
 
1006  
-        print "\nEND - expecting GEOS_NOTICE; safe to ignore.\n"
  1006
+        print("\nEND - expecting GEOS_NOTICE; safe to ignore.\n")
1007 1007
 
1008 1008
     def test28_geos_version(self):
1009 1009
         "Testing the GEOS version regular expression."
18  django/contrib/gis/utils/ogrinfo.py
@@ -22,19 +22,19 @@ def ogrinfo(data_source, num_features=10):
22 22
         raise Exception('Data source parameter must be a string or a DataSource object.')
23 23
 
24 24
     for i, layer in enumerate(data_source):
25  
-        print "data source : %s" % data_source.name
26  
-        print "==== layer %s" % i
27  
-        print "  shape type: %s" % GEO_CLASSES[layer.geom_type.num].__name__
28  
-        print "  # features: %s" % len(layer)
29  
-        print "         srs: %s" % layer.srs
  25
+        print("data source : %s" % data_source.name)
  26
+        print("==== layer %s" % i)
  27
+        print("  shape type: %s" % GEO_CLASSES[layer.geom_type.num].__name__)
  28
+        print("  # features: %s" % len(layer))
  29
+        print("         srs: %s" % layer.srs)
30 30
         extent_tup = layer.extent.tuple
31  
-        print "      extent: %s - %s" % (extent_tup[0:2], extent_tup[2:4])
32  
-        print "Displaying the first %s features ====" % num_features
  31
+        print("      extent: %s - %s" % (extent_tup[0:2], extent_tup[2:4]))
  32
+        print("Displaying the first %s features ====" % num_features)
33 33
 
34 34
         width = max(*map(len,layer.fields))
35 35
         fmt = " %%%ss: %%s" % width
36 36
         for j, feature in enumerate(layer[:num_features]):
37  
-            print "=== Feature %s" % j
  37
+            print("=== Feature %s" % j)
38 38
             for fld_name in layer.fields:
39 39
                 type_name = feature[fld_name].type_name
40 40
                 output = fmt % (fld_name, type_name)
@@ -47,7 +47,7 @@ def ogrinfo(data_source, num_features=10):
47 47
                     output += val_fmt % val
48 48
                 else:
49 49
                     output += ' (None)'
50  
-                print output
  50
+                print(output)
51 51
 
52 52
 # For backwards compatibility.
53 53
 sample = ogrinfo
4  django/contrib/gis/utils/ogrinspect.py
@@ -68,8 +68,8 @@ def ogrinspect(*args, **kwargs):
68 68
     shp_file = 'data/mapping_hacks/world_borders.shp'
69 69
     model_name = 'WorldBorders'
70 70
 
71  
-    print ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
72  
-                     geom_name='shapes', blank=True)
  71
+    print(ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
  72
+                     geom_name='shapes', blank=True))
73 73
 
74 74
     Required Arguments
75 75
      `datasource` => string or DataSource object to file pointer
4  django/contrib/sites/management.py
@@ -18,7 +18,7 @@ def create_default_site(app, created_models, verbosity, db, **kwargs):
18 18
         # the next id will be 1, so we coerce it. See #15573 and #16353. This
19 19
         # can also crop up outside of tests - see #15346.
20 20
         if verbosity >= 2:
21  
-            print "Creating example.com Site object"
  21
+            print("Creating example.com Site object")
22 22
         Site(pk=1, domain="example.com", name="example.com").save(using=db)
23 23
 
24 24
         # We set an explicit pk instead of relying on auto-incrementation,
@@ -26,7 +26,7 @@ def create_default_site(app, created_models, verbosity, db, **kwargs):
26 26
         sequence_sql = connections[db].ops.sequence_reset_sql(no_style(), [Site])
27 27
         if sequence_sql:
28 28
             if verbosity >= 2:
29  
-                print "Resetting sequence"
  29
+                print("Resetting sequence")
30 30
             cursor = connections[db].cursor()
31 31
             for command in sequence_sql:
32 32
                 cursor.execute(command)
4  django/core/management/__init__.py
@@ -299,7 +299,7 @@ def autocomplete(self):
299 299
 
300 300
         # subcommand
301 301
         if cword == 1:
302  
-            print ' '.join(sorted(filter(lambda x: x.startswith(curr), subcommands)))
  302
+            print(' '.join(sorted(filter(lambda x: x.startswith(curr), subcommands))))
303 303
         # subcommand options
304 304
         # special case: the 'help' subcommand has no options
305 305
         elif cwords[0] in subcommands and cwords[0] != 'help':
@@ -333,7 +333,7 @@ def autocomplete(self):
333 333
                 # append '=' to options which require args
334 334
                 if option[1]:
335 335
                     opt_label += '='
336  
-                print opt_label
  336
+                print(opt_label)
337 337
         sys.exit(1)
338 338
 
339 339
     def execute(self):
2  django/core/management/sql.py
@@ -173,7 +173,7 @@ def emit_post_sync_signal(created_models, verbosity, interactive, db):
173 173
     for app in models.get_apps():
174 174
         app_name = app.__name__.split('.')[-2]
175 175
         if verbosity >= 2:
176  
-            print "Running post-sync handlers for application", app_name
  176
+            print("Running post-sync handlers for application %s" % app_name)
177 177
         models.signals.post_syncdb.send(sender=app, app=app,
178 178
             created_models=created_models, verbosity=verbosity,
179 179
             interactive=interactive, db=db)
16  django/core/servers/fastcgi.py
@@ -82,9 +82,9 @@
82 82
 """ % FASTCGI_OPTIONS
83 83
 
84 84
 def fastcgi_help(message=None):
85  
-    print FASTCGI_HELP
  85
+    print(FASTCGI_HELP)
86 86
     if message:
87  
-        print message
  87
+        print(message)
88 88
     return False
89 89
 
90 90
 def runfastcgi(argset=[], **kwargs):
@@ -103,11 +103,11 @@ def runfastcgi(argset=[], **kwargs):
103 103
     try:
104 104
         import flup
105 105
     except ImportError as e:
106  
-        print >> sys.stderr, "ERROR: %s" % e
107  
-        print >> sys.stderr, "  Unable to load the flup package.  In order to run django"
108  
-        print >> sys.stderr, "  as a FastCGI application, you will need to get flup from"
109  
-        print >> sys.stderr, "  http://www.saddi.com/software/flup/   If you've already"
110  
-        print >> sys.stderr, "  installed flup, then make sure you have it in your PYTHONPATH."
  106
+        sys.stderr.write("ERROR: %s\n" % e)
  107
+        sys.stderr.write("  Unable to load the flup package.  In order to run django\n")
  108
+        sys.stderr.write("  as a FastCGI application, you will need to get flup from\n")
  109
+        sys.stderr.write("  http://www.saddi.com/software/flup/   If you've already\n")
  110
+        sys.stderr.write("  installed flup, then make sure you have it in your PYTHONPATH.\n")
111 111
         return False
112 112
 
113 113
     flup_module = 'server.' + options['protocol']
@@ -136,7 +136,7 @@ def runfastcgi(argset=[], **kwargs):
136 136
         module = importlib.import_module('.%s' % flup_module, 'flup')
137 137
         WSGIServer = module.WSGIServer
138 138
     except Exception:
139  
-        print "Can't import flup." + flup_module
  139
+        print("Can't import flup." + flup_module)
140 140
         return False
141 141
 
142 142
     # Prep up and go
14  django/db/backends/creation.py
@@ -256,8 +256,8 @@ def create_test_db(self, verbosity=1, autoclobber=False):
256 256
             test_db_repr = ''
257 257
             if verbosity >= 2:
258 258
                 test_db_repr = " ('%s')" % test_database_name
259  
-            print "Creating test database for alias '%s'%s..." % (
260  
-                self.connection.alias, test_db_repr)
  259
+            print("Creating test database for alias '%s'%s..." % (
  260
+                self.connection.alias, test_db_repr))
261 261
 
262 262
         self._create_test_db(verbosity, autoclobber)
263 263
 
@@ -339,8 +339,8 @@ def _create_test_db(self, verbosity, autoclobber):
339 339
             if autoclobber or confirm == 'yes':
340 340
                 try:
341 341
                     if verbosity >= 1:
342  
-                        print ("Destroying old test database '%s'..."
343  
-                               % self.connection.alias)
  342
+                        print("Destroying old test database '%s'..."
  343
+                              % self.connection.alias)
344 344
                     cursor.execute(
345 345
                         "DROP DATABASE %s" % qn(test_database_name))
346 346
                     cursor.execute(
@@ -351,7 +351,7 @@ def _create_test_db(self, verbosity, autoclobber):
351 351
                         "Got an error recreating the test database: %s\n" % e)
352 352
                     sys.exit(2)
353 353
             else:
354  
-                print "Tests cancelled."
  354
+                print("Tests cancelled.")
355 355
                 sys.exit(1)
356 356
 
357 357
         return test_database_name
@@ -367,8 +367,8 @@ def destroy_test_db(self, old_database_name, verbosity=1):
367 367
             test_db_repr = ''
368 368
             if verbosity >= 2:
369 369
                 test_db_repr = " ('%s')" % test_database_name
370  
-            print "Destroying test database for alias '%s'%s..." % (
371  
-                self.connection.alias, test_db_repr)
  370
+            print("Destroying test database for alias '%s'%s..." % (
  371
+                self.connection.alias, test_db_repr))
372 372
 
373 373
         # Temporarily use a new connection and a copy of the settings dict.
374 374
         # This prevents the production database from being exposed to potential
28  django/db/backends/oracle/creation.py
@@ -69,19 +69,19 @@ def _create_test_db(self, verbosity=1, autoclobber=False):
69 69
                 if autoclobber or confirm == 'yes':
70 70
                     try:
71 71
                         if verbosity >= 1:
72  
-                            print "Destroying old test database '%s'..." % self.connection.alias
  72
+                            print("Destroying old test database '%s'..." % self.connection.alias)
73 73
                         self._execute_test_db_destruction(cursor, parameters, verbosity)
74 74
                         self._execute_test_db_creation(cursor, parameters, verbosity)
75 75
                     except Exception as e:
76 76
                         sys.stderr.write("Got an error recreating the test database: %s\n" % e)
77 77
                         sys.exit(2)
78 78
                 else:
79  
-                    print "Tests cancelled."
  79
+                    print("Tests cancelled.")
80 80
                     sys.exit(1)
81 81
 
82 82
         if self._test_user_create():
83 83
             if verbosity >= 1:
84  
-                print "Creating test user..."
  84
+                print("Creating test user...")
85 85
             try:
86 86
                 self._create_test_user(cursor, parameters, verbosity)
87 87
             except Exception as e:
@@ -91,16 +91,16 @@ def _create_test_db(self, verbosity=1, autoclobber=False):
91 91
                 if autoclobber or confirm == 'yes':
92 92
                     try:
93 93
                         if verbosity >= 1:
94  
-                            print "Destroying old test user..."
  94
+                            print("Destroying old test user...")
95 95
                         self._destroy_test_user(cursor, parameters, verbosity)
96 96
                         if verbosity >= 1:
97  
-                            print "Creating test user..."
  97
+                            print("Creating test user...")
98 98
                         self._create_test_user(cursor, parameters, verbosity)
99 99
                     except Exception as e:
100 100
                         sys.stderr.write("Got an error recreating the test user: %s\n" % e)
101 101
                         sys.exit(2)
102 102
                 else:
103  
-                    print "Tests cancelled."
  103
+                    print("Tests cancelled.")
104 104
                     sys.exit(1)
105 105
 
106 106
         self.connection.settings_dict['SAVED_USER'] = self.connection.settings_dict['USER']
@@ -136,17 +136,17 @@ def _destroy_test_db(self, test_database_name, verbosity=1):
136 136
         time.sleep(1) # To avoid "database is being accessed by other users" errors.
137 137
         if self._test_user_create():
138 138
             if verbosity >= 1:
139  
-                print 'Destroying test user...'
  139
+                print('Destroying test user...')
140 140
             self._destroy_test_user(cursor, parameters, verbosity)
141 141
         if self._test_database_create():
142 142
             if verbosity >= 1:
143  
-                print 'Destroying test database tables...'
  143
+                print('Destroying test database tables...')
144 144
             self._execute_test_db_destruction(cursor, parameters, verbosity)
145 145
         self.connection.close()
146 146
 
147 147
     def _execute_test_db_creation(self, cursor, parameters, verbosity):
148 148
         if verbosity >= 2:
149  
-            print "_create_test_db(): dbname = %s" % parameters['dbname']
  149
+            print("_create_test_db(): dbname = %s" % parameters['dbname'])
150 150
         statements = [
151 151
             """CREATE TABLESPACE %(tblspace)s
152 152
                DATAFILE '%(tblspace)s.dbf' SIZE 20M
@@ -161,7 +161,7 @@ def _execute_test_db_creation(self, cursor, parameters, verbosity):
161 161
 
162 162
     def _create_test_user(self, cursor, parameters, verbosity):
163 163
         if verbosity >= 2:
164  
-            print "_create_test_user(): username = %s" % parameters['user']
  164
+            print("_create_test_user(): username = %s" % parameters['user'])
165 165
         statements = [
166 166
             """CREATE USER %(user)s
167 167
                IDENTIFIED BY %(password)s
@@ -174,7 +174,7 @@ def _create_test_user(self, cursor, parameters, verbosity):
174 174
 
175 175
     def _execute_test_db_destruction(self, cursor, parameters, verbosity):
176 176
         if verbosity >= 2:
177  
-            print "_execute_test_db_destruction(): dbname=%s" % parameters['dbname']
  177
+            print("_execute_test_db_destruction(): dbname=%s" % parameters['dbname'])
178 178
         statements = [
179 179
             'DROP TABLESPACE %(tblspace)s INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS',
180 180
             'DROP TABLESPACE %(tblspace_temp)s INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS',
@@ -183,8 +183,8 @@ def _execute_test_db_destruction(self, cursor, parameters, verbosity):
183 183
 
184 184
     def _destroy_test_user(self, cursor, parameters, verbosity):
185 185
         if verbosity >= 2:
186  
-            print "_destroy_test_user(): user=%s" % parameters['user']
187  
-            print "Be patient.  This can take some time..."
  186
+            print("_destroy_test_user(): user=%s" % parameters['user'])
  187
+            print("Be patient.  This can take some time...")
188 188
         statements = [
189 189
             'DROP USER %(user)s CASCADE',
190 190
         ]
@@ -194,7 +194,7 @@ def _execute_statements(self, cursor, statements, parameters, verbosity):
194 194
         for template in statements:
195 195
             stmt = template % parameters
196 196
             if verbosity >= 2:
197  
-                print stmt
  197
+                print(stmt)
198 198
             try:
199 199
                 cursor.execute(stmt)
200 200
             except Exception as err:
4  django/db/backends/sqlite3/creation.py
@@ -50,7 +50,7 @@ def _create_test_db(self, verbosity, autoclobber):
50 50
         if test_database_name != ':memory:':
51 51
             # Erase the old test database
52 52
             if verbosity >= 1:
53  
-                print "Destroying old test database '%s'..." % self.connection.alias
  53
+                print("Destroying old test database '%s'..." % self.connection.alias)
54 54
             if os.access(test_database_name, os.F_OK):
55 55
                 if not autoclobber:
56 56
                     confirm = raw_input("Type 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: " % test_database_name)
@@ -61,7 +61,7 @@ def _create_test_db(self, verbosity, autoclobber):
61 61
                       sys.stderr.write("Got an error deleting the old test database: %s\n" % e)
62 62
                       sys.exit(2)
63 63
                 else:
64  
-                    print "Tests cancelled."
  64
+                    print("Tests cancelled.")
65 65
                     sys.exit(1)
66 66
         return test_database_name
67 67
 
6  django/dispatch/saferef.py
@@ -122,9 +122,9 @@ def remove(weak, self=self):
122 122
                 except Exception as e:
123 123
                     try:
124 124
                         traceback.print_exc()
125  
-                    except AttributeError as err:
126  
-                        print '''Exception during saferef %s cleanup function %s: %s'''%(
127  
-                            self, function, e
  125
+                    except AttributeError:
  126
+                        print('Exception during saferef %s cleanup function %s: %s' % (
  127
+                            self, function, e)
128 128
                         )
129 129
         self.deletionMethods = [onDelete]
130 130
         self.key = self.calculateKey( target )
48  django/test/_doctest.py
@@ -878,7 +878,7 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):
878 878
         add them to `tests`.
879 879
         """
880 880
         if self._verbose:
881  
-            print 'Finding tests in %s' % name
  881
+            print('Finding tests in %s' % name)
882 882
 
883 883
         # If we've already processed this object, then ignore it.
884 884
         if id(obj) in seen:
@@ -1034,7 +1034,7 @@ class DocTestRunner:
1034 1034
         >>> tests = DocTestFinder().find(_TestClass)
1035 1035
         >>> runner = DocTestRunner(verbose=False)
1036 1036
         >>> for test in tests:
1037  
-        ...     print runner.run(test)
  1037
+        ...     print(runner.run(test))
1038 1038
         (0, 2)
1039 1039
         (0, 1)
1040 1040
         (0, 2)
@@ -1406,28 +1406,28 @@ def summarize(self, verbose=None):
1406 1406
                 failed.append(x)
1407 1407
         if verbose:
1408 1408
             if notests:
1409  
-                print len(notests), "items had no tests:"
  1409
+                print("%d items had no tests:" % len(notests))
1410 1410
                 notests.sort()
1411 1411
                 for thing in notests:
1412  
-                    print "   ", thing
  1412
+                    print("    %s" % thing)
1413 1413
             if passed:
1414  
-                print len(passed), "items passed all tests:"
  1414
+                print("%d items passed all tests:" % len(passed))
1415 1415
                 passed.sort()
1416 1416
                 for thing, count in passed:
1417  
-                    print " %3d tests in %s" % (count, thing)
  1417
+                    print(" %3d tests in %s" % (count, thing))
1418 1418
         if failed:
1419  
-            print self.DIVIDER
1420  
-            print len(failed), "items had failures:"
  1419
+            print(self.DIVIDER)
  1420
+            print("%d items had failures:" % len(failed))
1421 1421
             failed.sort()
1422 1422
             for thing, (f, t) in failed:
1423  
-                print " %3d of %3d in %s" % (f, t, thing)
  1423
+                print(" %3d of %3d in %s" % (f, t, thing))
1424 1424
         if verbose:
1425  
-            print totalt, "tests in", len(self._name2ft), "items."
1426  
-            print totalt - totalf, "passed and", totalf, "failed."
  1425
+            print("%d tests in % d items" % (len(self._name2ft), totalt))
  1426
+            print("%d passed and %d failed." % (totalt - totalf,  totalf))
1427 1427
         if totalf:
1428  
-            print "***Test Failed***", totalf, "failures."
  1428
+            print("***Test Failed*** %d failures." % totalf)
1429 1429
         elif verbose:
1430  
-            print "Test passed."
  1430
+            print("Test passed.")
1431 1431
         return totalf, totalt
1432 1432
 
1433 1433
     #/////////////////////////////////////////////////////////////////
@@ -1437,8 +1437,8 @@ def merge(self, other):
1437 1437
         d = self._name2ft
1438 1438
         for name, (f, t) in other._name2ft.items():
1439 1439
             if name in d:
1440  
-                print "*** DocTestRunner.merge: '" + name + "' in both" \
1441  
-                    " testers; summing outcomes."
  1440
+                print("*** DocTestRunner.merge: '" + name + "' in both" \
  1441
+                    " testers; summing outcomes.")
1442 1442
                 f2, t2 = d[name]
1443 1443
                 f = f + f2
1444 1444
                 t = t + t2
@@ -2007,10 +2007,10 @@ def __init__(self, mod=None, globs=None, verbose=None, optionflags=0):
2007 2007
     def runstring(self, s, name):
2008 2008
         test = DocTestParser().get_doctest(s, self.globs, name, None, None)
2009 2009
         if self.verbose:
2010  
-            print "Running string", name
  2010
+            print("Running string %s" % name)
2011 2011
         (f,t) = self.testrunner.run(test)
2012 2012
         if self.verbose:
2013  
-            print f, "of", t, "examples failed in string", name
  2013
+            print("%s of %s examples failed in string %s" % (f, t, name))
2014 2014
         return (f,t)
2015 2015
 
2016 2016
     def rundoc(self, object, name=None, module=None):
@@ -2442,7 +2442,7 @@ def script_from_examples(s):
2442 2442
        ...           Ho hum
2443 2443
        ...           '''
2444 2444
 
2445  
-       >>> print script_from_examples(text)
  2445
+       >>> print(script_from_examples(text))
2446 2446
        # Here are examples of simple math.
2447 2447
        #
2448 2448
        #     Python has super accurate integer addition
@@ -2533,7 +2533,7 @@ def debug_script(src, pm=False, globs=None):
2533 2533
             try:
2534 2534
                 execfile(srcfilename, globs, globs)
2535 2535
             except:
2536  
-                print sys.exc_info()[1]
  2536
+                print(sys.exc_info()[1])
2537 2537
                 pdb.post_mortem(sys.exc_info()[2])
2538 2538
         else:
2539 2539
             # Note that %r is vital here.  '%s' instead can, e.g., cause
@@ -2575,7 +2575,7 @@ def __init__(self, val):
2575 2575
         """val -> _TestClass object with associated value val.
2576 2576
 
2577 2577
         >>> t = _TestClass(123)
2578  
-        >>> print t.get()
  2578
+        >>> print(t.get())
2579 2579
         123
2580 2580
         """
2581 2581
 
@@ -2595,7 +2595,7 @@ def get(self):
2595 2595
         """get() -> return TestClass's associated value.
2596 2596
 
2597 2597
         >>> x = _TestClass(-42)
2598  
-        >>> print x.get()
  2598
+        >>> print(x.get())
2599 2599
         -42
2600 2600
         """
2601 2601
 
@@ -2627,7 +2627,7 @@ def get(self):
2627 2627
 
2628 2628
             "blank lines": r"""
2629 2629
                 Blank lines can be marked with <BLANKLINE>:
2630  
-                    >>> print 'foo\n\nbar\n'
  2630
+                    >>> print('foo\n\nbar\n')
2631 2631
                     foo
2632 2632
                     <BLANKLINE>
2633 2633
                     bar
@@ -2637,14 +2637,14 @@ def get(self):
2637 2637
             "ellipsis": r"""
2638 2638
                 If the ellipsis flag is used, then '...' can be used to
2639 2639
                 elide substrings in the desired output:
2640  
-                    >>> print range(1000) #doctest: +ELLIPSIS
  2640
+                    >>> print(range(1000)) #doctest: +ELLIPSIS
2641 2641
                     [0, 1, 2, ..., 999]
2642 2642
             """,
2643 2643
 
2644 2644
             "whitespace normalization": r"""
2645 2645
                 If the whitespace normalization flag is used, then
2646 2646
                 differences in whitespace are ignored.
2647  
-                    >>> print range(30) #doctest: +NORMALIZE_WHITESPACE
  2647
+                    >>> print(range(30)) #doctest: +NORMALIZE_WHITESPACE
2648 2648
                     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2649 2649
                      15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2650 2650
                      27, 28, 29]
2  django/utils/dateformat.py
@@ -6,7 +6,7 @@
6 6
 >>> import datetime
7 7
 >>> d = datetime.datetime.now()
8 8
 >>> df = DateFormat(d)
9  
->>> print df.format('jS F Y H:i')
  9
+>>> print(df.format('jS F Y H:i'))
10 10
 7th October 2003 11:39
11 11
 >>>
12 12
 """
10  django/utils/termcolors.py
@@ -33,10 +33,10 @@ def colorize(text='', opts=(), **kwargs):
33 33
         colorize('hello', fg='red', bg='blue', opts=('blink',))
34 34
         colorize()
35 35
         colorize('goodbye', opts=('underscore',))
36  
-        print colorize('first line', fg='red', opts=('noreset',))
37  
-        print 'this should be red too'
38  
-        print colorize('and so should this')
39  
-        print 'this should not be red'
  36
+        print(colorize('first line', fg='red', opts=('noreset',)))
  37
+        print('this should be red too')
  38
+        print(colorize('and so should this'))
  39
+        print('this should not be red')
40 40
     """
41 41
     code_list = []
42 42
     if text == '' and len(opts) == 1 and opts[0] == 'reset':
@@ -59,7 +59,7 @@ def make_style(opts=(), **kwargs):
59 59
 
60 60
     Example:
61 61
         bold_red = make_style(opts=('bold',), fg='red')
62  
-        print bold_red('hello')
  62
+        print(bold_red('hello'))
63 63
         KEYWORD = make_style(fg='yellow')
64 64
         COMMENT = make_style(fg='blue', opts=('bold',))
65 65
     """
4  django/utils/unittest/main.py
@@ -99,7 +99,7 @@ def __init__(self, module='__main__', defaultTest=None,
99 99
 
100 100
     def usageExit(self, msg=None):
101 101
         if msg:
102  
-            print msg
  102
+            print(msg)
103 103
         usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '',
104 104
                  'buffer': ''}
105 105
         if self.failfast != False:
@@ -108,7 +108,7 @@ def usageExit(self, msg=None):
108 108
             usage['catchbreak'] = CATCHBREAK
109 109
         if self.buffer != False:
110 110
             usage['buffer'] = BUFFEROUTPUT
111  
-        print self.USAGE % usage
  111
+        print(self.USAGE % usage)
112 112
         sys.exit(2)
113 113
 
114 114
     def parseArgs(self, argv):
6  docs/_ext/applyxrefs.py
@@ -77,12 +77,12 @@ def main(argv=None):
77 77
         target_found, lines = has_target(fn)
78 78
         if not target_found:
79 79
             if testing:
80  
-                print '%s: %s' % (fn, lines[0]),
  80
+                print('%s: %s' % (fn, lines[0]))
81 81
             else:
82  
-                print "Adding xref to %s" % fn
  82
+                print("Adding xref to %s" % fn)
83 83
                 process_file(fn, lines)
84 84
         else:
85 85
             print "Skipping %s: already has a xref" % fn
86 86
 
87 87
 if __name__ == '__main__':
88  
-    sys.exit(main())
  88
+    sys.exit(main())
10  docs/_ext/literals_to_xrefs.py
@@ -136,10 +136,10 @@ def colorize(text='', opts=(), **kwargs):
136 136
         colorize('hello', fg='red', bg='blue', opts=('blink',))
137 137
         colorize()
138 138
         colorize('goodbye', opts=('underscore',))
139  
-        print colorize('first line', fg='red', opts=('noreset',))
140  
-        print 'this should be red too'
141  
-        print colorize('and so should this')
142  
-        print 'this should not be red'
  139
+        print(colorize('first line', fg='red', opts=('noreset',)))
  140
+        print('this should be red too')
  141
+        print(colorize('and so should this'))
  142
+        print('this should not be red')
143 143
     """
144 144
     color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
145 145
     foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
@@ -168,4 +168,4 @@ def colorize(text='', opts=(), **kwargs):
168 168
     try:
169 169
         fixliterals(sys.argv[1])
170 170
     except (KeyboardInterrupt, SystemExit):
171  
-        print
  171
+        print('')
2  docs/howto/custom-model-fields.txt
@@ -55,7 +55,7 @@ We'd like to be able to do things like this in our models (we assume the
55 55
 ``hand`` attribute on the model is an instance of ``Hand``)::
56 56
 
57 57
     example = MyModel.objects.get(pk=1)
58  
-    print example.hand.north
  58
+    print(example.hand.north)
59 59
 
60 60
     new_hand = Hand(north, east, south, west)
61 61
     example.hand = new_hand
2  docs/intro/install.txt
@@ -83,7 +83,7 @@ To verify that Django can be seen by Python, type ``python`` from your shell.
83 83
 Then at the Python prompt, try to import Django::
84 84
 
85 85
     >>> import django
86  
-    >>> print django.get_version()
  86
+    >>> print(django.get_version())
87 87
     1.4
88 88
 
89 89
 
2  docs/ref/contrib/gis/db-api.txt
@@ -76,7 +76,7 @@ transform procedure::
76 76
     >>> z = Zipcode(code=78212, poly=poly_3084)
77 77
     >>> z.save()
78 78
     >>> from django.db import connection
79  
-    >>> print connection.queries[-1]['sql'] # printing the last SQL statement executed (requires DEBUG=True)
  79
+    >>> print(connection.queries[-1]['sql']) # printing the last SQL statement executed (requires DEBUG=True)
80 80
     INSERT INTO "geoapp_zipcode" ("code", "poly") VALUES (78212, ST_Transform(ST_GeomFromWKB('\\001 ... ', 3084), 4326))
81 81
 
82 82
 Thus, geometry parameters may be passed in using the ``GEOSGeometry`` object, WKT
24  docs/ref/contrib/gis/gdal.txt
@@ -114,7 +114,7 @@ __ http://www.gdal.org/ogr/ogr_formats.html
114 114
    information about each layer in a :class:`DataSource`::
115 115
 
116 116
        >>> for layer in ds:
117  
-       ...     print 'Layer "%s": %i %ss' % (layer.name, len(layer), layer.geom_type.name)
  117
+       ...     print('Layer "%s": %i %ss' % (layer.name, len(layer), layer.geom_type.name))
118 118
        ...
119 119
        Layer "cities": 3 Points
120 120
 
@@ -200,7 +200,7 @@ __ http://www.gdal.org/ogr/ogr_formats.html
200 200
    Property that returns the :class:`SpatialReference` associated
201 201
    with this layer::
202 202
 
203  
-       >>> print layer.srs
  203
+       >>> print(layer.srs)
204 204
        GEOGCS["GCS_WGS_1984",
205 205
            DATUM["WGS_1984",
206 206
                SPHEROID["WGS_1984",6378137,298.257223563]],
@@ -220,9 +220,9 @@ __ http://www.gdal.org/ogr/ogr_formats.html
220 220
    other than ``None``, only features that intersect the filter will be
221 221
    returned when iterating over the layer::
222 222
 
223  
-       >>> print layer.spatial_filter
  223
+       >>> print(layer.spatial_filter)
224 224
        None
225  
-       >>> print len(layer)
  225
+       >>> print(len(layer))
226 226
        3
227 227
        >>> [feat.get('Name') for feat in layer]
228 228
        ['Pueblo', 'Lawrence', 'Houston']
@@ -814,7 +814,7 @@ systems and coordinate transformation::
814 814
        >>> gt1 = OGRGeomType(3)             # Using an integer for the type
815 815
        >>> gt2 = OGRGeomType('Polygon')     # Using a string
816 816
        >>> gt3 = OGRGeomType('POLYGON')     # It's case-insensitive
817  
-       >>> print gt1 == 3, gt1 == 'Polygon' # Equivalence works w/non-OGRGeomType objects
  817
+       >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
818 818
        True True
819 819
 
820 820
    .. attribute:: name
@@ -927,19 +927,19 @@ Coordinate System Objects
927 927
 
928 928
        >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
929 929
        >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
930  
-       >>> print srs['GEOGCS']
  930
+       >>> print(srs['GEOGCS'])
931 931
        WGS 84
932  
-       >>> print srs['DATUM']
  932
+       >>> print(srs['DATUM'])
933 933
        WGS_1984
934  
-       >>> print srs['AUTHORITY']
  934
+       >>> print(srs['AUTHORITY'])
935 935
        EPSG
936  
-       >>> print srs['AUTHORITY', 1] # The authority value
  936
+       >>> print(srs['AUTHORITY', 1]) # The authority value
937 937
        4326
938  
-       >>> print srs['TOWGS84', 4] # the fourth value in this wkt
  938
+       >>> print(srs['TOWGS84', 4]) # the fourth value in this wkt
939 939
        0
940  
-       >>> print srs['UNIT|AUTHORITY'] # For the units authority, have to use the pipe symbol.
  940
+       >>> print(srs['UNIT|AUTHORITY']) # For the units authority, have to use the pipe symbol.
941 941
        EPSG
942  
-       >>> print srs['UNIT|AUTHORITY', 1] # The authority value for the units
  942
+       >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the units
943 943
        9122
944 944
 
945 945
    .. method:: attr_value(target, index=0)
16  docs/ref/contrib/gis/geoquerysets.txt
@@ -714,7 +714,7 @@ the distance from the `Tasmanian`__ city of Hobart to every other
714 714
 :class:`PointField` in the ``AustraliaCity`` queryset is calculated::
715 715
 
716 716
     >>> pnt = AustraliaCity.objects.get(name='Hobart').point
717  
-    >>> for city in AustraliaCity.objects.distance(pnt): print city.name, city.distance
  717
+    >>> for city in AustraliaCity.objects.distance(pnt): print(city.name, city.distance)
718 718
     Wollongong 990071.220408 m
719 719
     Shellharbour 972804.613941 m
720 720
     Thirroul 1002334.36351 m
@@ -874,9 +874,9 @@ Example::
874 874
 
875 875
     >>> qs = Zipcode.objects.all().transform() # Transforms to WGS84
876 876
     >>> qs = Zipcode.objects.all().transform(32140) # Transforming to "NAD83 / Texas South Central"
877  
-    >>> print qs[0].poly.srid
  877
+    >>> print(qs[0].poly.srid)
878 878
     32140
879  
-    >>> print qs[0].poly
  879
+    >>> print(qs[0].poly)
880 880
     POLYGON ((234055.1698884720099159 4937796.9232223574072123 ...
881 881
 
882 882
 ``translate``
@@ -990,7 +990,7 @@ Attaches a ``gml`` attribute to every model in the queryset that contains the
990 990
 Example::
991 991
 
992 992
     >>> qs = Zipcode.objects.all().gml()
993  
-    >>> print qs[0].gml
  993
+    >>> print(qs[0].gml)
994 994
     <gml:Polygon srsName="EPSG:4326"><gml:OuterBoundaryIs>-147.78711,70.245363 ...  -147.78711,70.245363</gml:OuterBoundaryIs></gml:Polygon>
995 995
 
996 996
 =====================  =====================================================
@@ -1023,7 +1023,7 @@ necessary.
1023 1023
 Example::
1024 1024
 
1025 1025
     >>> qs = Zipcode.objects.all().kml()
1026  
-    >>> print qs[0].kml
  1026
+    >>> print(qs[0].kml)
1027 1027
     <Polygon><outerBoundaryIs><LinearRing><coordinates>-103.04135,36.217596,0 ... -103.04135,36.217596,0</coordinates></LinearRing></outerBoundaryIs></Polygon>
1028 1028
 
1029 1029
 =====================  =====================================================
@@ -1128,7 +1128,7 @@ lower left coordinate and the upper right coordinate.
1128 1128
 Example::
1129 1129
 
1130 1130
     >>> qs = City.objects.filter(name__in=('Houston', 'Dallas'))
1131  
-    >>> print qs.extent()
  1131
+    >>> print(qs.extent())
1132 1132
     (-96.8016128540039, 29.7633724212646, -95.3631439208984, 32.782058715820)
1133 1133
 
1134 1134
 ``extent3d``
@@ -1146,7 +1146,7 @@ the lower left coordinate and upper right coordinate.
1146 1146
 Example::
1147 1147
 
1148 1148
     >>> qs = City.objects.filter(name__in=('Houston', 'Dallas'))
1149  
-    >>> print qs.extent3d()
  1149
+    >>> print(qs.extent3d())
1150 1150
     (-96.8016128540039, 29.7633724212646, 0, -95.3631439208984, 32.782058715820, 0)
1151 1151
 
1152 1152
 ``make_line``
@@ -1161,7 +1161,7 @@ Returns a ``LineString`` constructed from the point field geometries in the
1161 1161
 
1162 1162
 Example::
1163 1163
 
1164  
-     >>> print City.objects.filter(name__in=('Houston', 'Dallas')).make_line()
  1164
+     >>> print(City.objects.filter(name__in=('Houston', 'Dallas')).make_line())
1165 1165
      LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018)
1166 1166
 
1167 1167
 ``unionagg``
2  docs/ref/contrib/gis/geos.txt
@@ -231,7 +231,7 @@ Property that may be used to retrieve or set the SRID associated with the
231 231
 geometry.  For example::
232 232
 
233 233
     >>> pnt = Point(5, 23)
234  
-    >>> print pnt.srid
  234
+    >>> print(pnt.srid)
235 235
     None
236 236
     >>> pnt.srid = 4326
237 237
     >>> pnt.srid
8  docs/ref/contrib/gis/layermapping.txt
@@ -39,13 +39,13 @@ Example
39 39
     >>> from django.contrib.gis.gdal import DataSource
40 40
     >>> ds = DataSource('test_poly.shp')
41 41
     >>> layer = ds[0]
42  
-    >>> print layer.fields # Exploring the fields in the layer, we only want the 'str' field.
  42
+    >>> print(layer.fields) # Exploring the fields in the layer, we only want the 'str' field.
43 43
     ['float', 'int', 'str']
44  
-    >>> print len(layer) # getting the number of features in the layer (should be 3)
  44
+    >>> print(len(layer)) # getting the number of features in the layer (should be 3)
45 45
     3
46  
-    >>> print layer.geom_type # Should be 'Polygon'
  46
+    >>> print(layer.geom_type) # Should be 'Polygon'
47 47
     Polygon
48  
-    >>> print layer.srs # WGS84 in WKT
  48
+    >>> print(layer.srs) # WGS84 in WKT
49 49
     GEOGCS["GCS_WGS_1984",
50 50
         DATUM["WGS_1984",
51 51
             SPHEROID["WGS_1984",6378137,298.257223563]],
22  docs/ref/contrib/gis/measure.txt
@@ -22,41 +22,41 @@ instantiated in units of kilometers (``km``) and miles (``mi``)::
22 22
 
23 23
     >>> from django.contrib.gis.measure import Distance, D
24 24
     >>> d1 = Distance(km=5)
25  
-    >>> print d1
  25
+    >>> print(d1)
26 26
     5.0 km
27 27
     >>> d2 = D(mi=5) # `D` is an alias for `Distance`
28  
-    >>> print d2
  28
+    >>> print(d2)
29 29
     5.0 mi
30 30
 
31 31
 Conversions are easy, just access the preferred unit attribute to get a
32 32
 converted distance quantity::
33 33
 
34  
-    >>> print d1.mi # Converting 5 kilometers to miles
  34
+    >>> print(d1.mi) # Converting 5 kilometers to miles
35 35
     3.10685596119
36  
-    >>> print d2.km # Converting 5 miles to kilometers
  36
+    >>> print(d2.km) # Converting 5 miles to kilometers
37 37
     8.04672
38 38
 
39 39
 Moreover, arithmetic operations may be performed between the distance
40 40
 objects::
41 41
 
42  
-    >>> print d1 + d2 # Adding 5 miles to 5 kilometers
  42
+    >>> print(d1 + d2) # Adding 5 miles to 5 kilometers
43 43
     13.04672 km
44  
-    >>> print d2 - d1 # Subtracting 5 kilometers from 5 miles
  44
+    >>> print(d2 - d1) # Subtracting 5 kilometers from 5 miles
45 45
     1.89314403881 mi
46 46
 
47 47
 Two :class:`Distance` objects multiplied together will yield an :class:`Area`
48 48
 object, which uses squared units of measure::
49 49
 
50 50
     >>> a = d1 * d2 # Returns an Area object.
51  
-    >>> print a
  51
+    >>> print(a)
52 52
     40.2336 sq_km
53 53
 
54 54
 To determine what the attribute abbreviation of a unit is, the ``unit_attname``
55 55
 class method may be used::
56 56
 
57  
-    >>> print Distance.unit_attname('US Survey Foot')