[svn] small `__repr__` tweaks
authorArmin Ronacher <armin.ronacher@active-4.com>
Mon, 12 Mar 2007 16:32:18 +0000 (17:32 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Mon, 12 Mar 2007 16:32:18 +0000 (17:32 +0100)
--HG--
branch : trunk

jinja/datastructure.py

index 9ba9e9a39406e1cde333162b3d7cc236483661ec..3b13ae060b62477abb385ed8f3619c9607f957d1 100644 (file)
@@ -139,6 +139,8 @@ class Context(object):
         result = {}
         for layer in self._stack[1:]:
             for key, value in layer.iteritems():
+                if key.startswith('::'):
+                    continue
                 result[key] = value
         return result
 
@@ -238,6 +240,15 @@ class LoopContext(object):
                                    'to define them with the "recursive" '
                                    'modifier.')
 
+    def __repr__(self):
+        if self._stack:
+            return '<LoopContext %d/%d%s>' % (
+                self.index,
+                self.length,
+                self.loop_function is not None and ' recursive' or ''
+            )
+        return '<LoopContext (empty)>'
+
 
 class CycleContext(object):
     """