Run `./2to3.py -w jinja2`
[jinja2.git] / jinja2 / sandbox.py
index a1cbb29ac3166101945ea9f8e9fdb49c60095d31..fc1b4241e0827638c5d4c12f9abea4eb7772e948 100644 (file)
@@ -46,7 +46,7 @@ _mutable_sequence_types = (list,)
 # on python 2.x we can register the user collection types
 try:
     from UserDict import UserDict, DictMixin
-    from UserList import UserList
+    from collections import UserList
     _mutable_mapping_types += (UserDict, DictMixin)
     _mutable_set_types += (UserList,)
 except ImportError:
@@ -90,7 +90,7 @@ def safe_range(*args):
     """A range that can't generate ranges with a length of more than
     MAX_RANGE items.
     """
-    rng = xrange(*args)
+    rng = range(*args)
     if len(rng) > MAX_RANGE:
         raise OverflowError('range too big, maximum size for range is %d' %
                             MAX_RANGE)
@@ -299,7 +299,7 @@ class SandboxedEnvironment(Environment):
         try:
             return obj[argument]
         except (TypeError, LookupError):
-            if isinstance(argument, basestring):
+            if isinstance(argument, str):
                 try:
                     attr = str(argument)
                 except Exception: