summaryrefslogtreecommitdiff
path: root/paste/util
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-03-19 12:51:48 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-03-19 12:51:48 +0100
commit4c177fce89fee925f0f4fbfde00ce2e1252562c0 (patch)
tree3e7a8a8f9771aeb649449b390d1ba5038cc32059 /paste/util
parent4450e264ae1d68e0150e0ab9f611118d9797d694 (diff)
downloadpaste-4c177fce89fee925f0f4fbfde00ce2e1252562c0.tar.gz
Python 3: fix more submodules
* print syntax * replace "except Exception, exc:" with "except Exception as exc:"
Diffstat (limited to 'paste/util')
-rw-r--r--paste/util/PySourceColor.py2
-rw-r--r--paste/util/finddata.py11
-rw-r--r--paste/util/looper.py4
-rw-r--r--paste/util/quoting.py4
-rw-r--r--paste/util/template.py8
5 files changed, 14 insertions, 15 deletions
diff --git a/paste/util/PySourceColor.py b/paste/util/PySourceColor.py
index 35efc7f..1c11041 100644
--- a/paste/util/PySourceColor.py
+++ b/paste/util/PySourceColor.py
@@ -832,7 +832,7 @@ def _test(show=0, quiet=0):
@A @B(arghh) @C
def LlamaSaysNi(arg='Ni!',arg2="RALPH"):
"""This docstring is deeply disturbed by all the llama references"""
- print '%s The Wonder Llama says %s'% (arg2,arg)
+ print('%s The Wonder Llama says %s'% (arg2,arg))
# So I was like duh!, and he was like ya know?!,
# and so we were both like huh...wtf!? RTFM!! LOL!!;)
@staticmethod## Double comments are KewL.
diff --git a/paste/util/finddata.py b/paste/util/finddata.py
index af29c04..05c8546 100644
--- a/paste/util/finddata.py
+++ b/paste/util/finddata.py
@@ -4,6 +4,7 @@
# you can't import this from another package, when you don't know if
# that package is installed yet.
+from __future__ import print_function
import os
import sys
from fnmatch import fnmatchcase
@@ -61,9 +62,8 @@ def find_package_data(
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
- print >> sys.stderr, (
- "Directory %s ignored by pattern %s"
- % (fn, pattern))
+ print("Directory %s ignored by pattern %s"
+ % (fn, pattern), file=sys.stderr)
break
if bad_name:
continue
@@ -84,9 +84,8 @@ def find_package_data(
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
- print >> sys.stderr, (
- "File %s ignored by pattern %s"
- % (fn, pattern))
+ print("File %s ignored by pattern %s"
+ % (fn, pattern), file=sys.stderr)
break
if bad_name:
continue
diff --git a/paste/util/looper.py b/paste/util/looper.py
index 8116323..efe7fdf 100644
--- a/paste/util/looper.py
+++ b/paste/util/looper.py
@@ -7,9 +7,9 @@ These can be awkward to manage in a normal Python loop, but using the
looper you can get a better sense of the context. Use like::
>>> for loop, item in looper(['a', 'b', 'c']):
- ... print loop.number, item
+ ... print(loop.number, item)
... if not loop.last:
- ... print '---'
+ ... print('---')
1 a
---
2 b
diff --git a/paste/util/quoting.py b/paste/util/quoting.py
index 8c578ee..8c4c749 100644
--- a/paste/util/quoting.py
+++ b/paste/util/quoting.py
@@ -87,8 +87,8 @@ def comment_quote(s):
"""
comment = str(s)
#comment = _bad_chars_re.sub('', comment)
- #print 'in ', repr(str(s))
- #print 'out', repr(comment)
+ #print('in ', repr(str(s)))
+ #print('out', repr(comment))
comment = _comment_quote_re.sub('-&gt;', comment)
return comment
diff --git a/paste/util/template.py b/paste/util/template.py
index cdf503a..afeb353 100644
--- a/paste/util/template.py
+++ b/paste/util/template.py
@@ -213,7 +213,7 @@ class Template(object):
def _exec(self, code, ns, pos):
__traceback_hide__ = True
try:
- exec code in ns
+ six.exec_(code, ns)
except:
exc_info = sys.exc_info()
e = exc_info[1]
@@ -715,8 +715,8 @@ def fill_command(args=None):
help="Put the environment in as top-level variables")
options, args = parser.parse_args(args)
if len(args) < 1:
- print 'You must give a template filename'
- print dir(parser)
+ print('You must give a template filename')
+ print(dir(parser))
assert 0
template_name = args[0]
args = args[1:]
@@ -725,7 +725,7 @@ def fill_command(args=None):
vars.update(os.environ)
for value in args:
if '=' not in value:
- print 'Bad argument: %r' % value
+ print('Bad argument: %r' % value)
sys.exit(2)
name, value = value.split('=', 1)
if name.startswith('py:'):