From 37830928d024c35d83ded3648a0c2e9990f6df09 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 21 Oct 2007 23:04:28 +0200 Subject: [PATCH] added pretty print for context --HG-- branch : trunk --- jinja/datastructure.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jinja/datastructure.py b/jinja/datastructure.py index d265d8d..2408dd0 100644 --- a/jinja/datastructure.py +++ b/jinja/datastructure.py @@ -313,6 +313,17 @@ class Context(BaseContext): """ return 'Context(%r)' % self.to_dict() + def __pretty__(self, p, cycle): + p.begin_group(9, 'Context({') + for idx, (key, value) in enumerate(self.to_dict().iteritems()): + if idx: + p.text(',') + p.breakable() + p.pretty(key) + p.text(': ') + p.pretty(value) + p.end_group(9, '})') + class LoopContext(object): """ -- 2.26.2