aboutsummaryrefslogtreecommitdiffstats
path: root/mako/ast.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-11-11 14:38:56 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-11-11 14:38:56 -0500
commit1eb56ef02a7fa825be99ddfb95f217a07dab1cdf (patch)
treebf0857b7f42dec7db03910799eed7e5dda5e7c2b /mako/ast.py
parent4ab9664a515c265238d420b0373f7225fe2e53c7 (diff)
downloadexternal_python_mako-1eb56ef02a7fa825be99ddfb95f217a07dab1cdf.tar.gz
external_python_mako-1eb56ef02a7fa825be99ddfb95f217a07dab1cdf.tar.bz2
external_python_mako-1eb56ef02a7fa825be99ddfb95f217a07dab1cdf.zip
- first pass at running a py3k compatible base in py2k as well.
having some weird unicode issues I can't debug; the meaning of str.encode() seems to be changing globally somehow
Diffstat (limited to 'mako/ast.py')
-rw-r--r--mako/ast.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mako/ast.py b/mako/ast.py
index 76311e9..0298a11 100644
--- a/mako/ast.py
+++ b/mako/ast.py
@@ -7,7 +7,7 @@
"""utilities for analyzing expressions and blocks of Python
code, as well as generating Python from AST nodes"""
-from mako import exceptions, pyparser, util
+from mako import exceptions, pyparser, compat
import re
class PythonCode(object):
@@ -33,7 +33,7 @@ class PythonCode(object):
# - AST is less likely to break with version changes
# (for example, the behavior of co_names changed a little bit
# in python version 2.5)
- if isinstance(code, basestring):
+ if isinstance(code, compat.string_types):
expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
else:
expr = code
@@ -48,7 +48,7 @@ class ArgumentList(object):
self.args = []
self.declared_identifiers = set()
self.undeclared_identifiers = set()
- if isinstance(code, basestring):
+ if isinstance(code, compat.string_types):
if re.match(r"\S", code) and not re.match(r",\s*$", code):
# if theres text and no trailing comma, insure its parsed
# as a tuple by adding a trailing comma