From b805fa2bb25eb2cb3415da9b160576d5f2ae1e9a Mon Sep 17 00:00:00 2001 From: Toby Date: Mon, 14 May 2012 11:22:20 +0100 Subject: [PATCH] add debug_inspect() helper functionw --- ckan/lib/helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index 1e67ae1c8b9..7b6678c7013 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -10,6 +10,7 @@ import logging import re import urllib +import pprint from paste.deploy.converters import asbool from webhelpers.html import escape, HTML, literal, url_escape @@ -801,6 +802,10 @@ def include_resource(resource): r = getattr(html_resources, resource) r.need() +def debug_inspect(arg): + ''' Output pprint.pformat view of supplied arg ''' + return literal('
') + pprint.pformat(arg) + literal('
') + # these are the functions that will end up in `h` template helpers # if config option restrict_template_vars is true __allowed_functions__ = [ @@ -866,4 +871,5 @@ def include_resource(resource): 'radio', 'submit', 'asbool', + 'debug_inspect', ]