From: Armin Ronacher Date: Sun, 21 Oct 2007 21:04:28 +0000 (+0200) Subject: added pretty print for context X-Git-Tag: 2.0rc1~252 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37830928d024c35d83ded3648a0c2e9990f6df09;p=jinja2.git added pretty print for context --HG-- branch : trunk --- 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): """