]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
feature to version check for context dict methods
authorArmin Ronacher <armin.ronacher@active-4.com>
Mon, 20 May 2013 01:15:04 +0000 (02:15 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Mon, 20 May 2013 01:15:04 +0000 (02:15 +0100)
jinja2/runtime.py

index 71485c8f40feb0dcb3b20d946fe50697a8c21449..38a86974586f22720797ccfc16771612a67e4641 100644 (file)
@@ -15,7 +15,7 @@ from jinja2.utils import Markup, soft_unicode, escape, missing, concat, \
 from jinja2.exceptions import UndefinedError, TemplateRuntimeError, \
      TemplateNotFound
 from jinja2._compat import next, imap, text_type, iteritems, \
-     implements_iterator, implements_to_string, string_types
+     implements_iterator, implements_to_string, string_types, PY2
 
 
 # these variables are exported to the template runtime
@@ -216,7 +216,7 @@ class Context(object):
     items = _all('items')
 
     # not available on python 3
-    if hasattr(dict, 'iterkeys'):
+    if PY2:
         iterkeys = _all('iterkeys')
         itervalues = _all('itervalues')
         iteritems = _all('iteritems')