Skip to content

Commit

Permalink
[2375] Split the h.debug_full_info() into two functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Jun 7, 2012
1 parent 517031d commit abe5d3f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ckan/lib/helpers.py
Expand Up @@ -961,7 +961,7 @@ def debug_inspect(arg):
''' Output pprint.pformat view of supplied arg '''
return literal('<pre>') + pprint.pformat(arg) + literal('</pre>')

def debug_full_info():
def debug_full_info_as_list():
''' This dumps the template variables for debugging purposes only. '''
out = []
ignored_keys = ['c', 'app_globals', 'g', 'h', 'request', 'tmpl_context',
Expand All @@ -976,20 +976,27 @@ def debug_full_info():
'__template_name', '__template_path',
'__weakref__', 'action', 'environ', 'pylons',
'start_response']

for key in c.__context.keys():
if not key in ignored_keys:
out.append('<b>%s<b> : <pre>%s</pre>' %
(key, escape(c.__context.get(key))))
out.append((key, c.__context.get(key)))

for key in dir(c.__context['tmpl_context']):
if not key in ignored_context_keys:
out.append('<b>%s</b> : <pre>%s</pre>' %
(key, escape(pprint.pformat(getattr(c, key)))))
out.append((key, pprint.pformat(getattr(c, key))))

return literal('<br/>'.join(out))
return out

def debug_full_info():
''' This dumps the template variables for debugging purposes only. '''
out = []
info = debug_full_info_as_list()

for key, value in info:
out.append('<b>%s<b> : <pre>%s</pre>' %
(key, escape(value)))

return literal('<br/>'.join(out))

def popular(type_, number, min=1, title=None):
''' display a popular icon. '''
Expand Down Expand Up @@ -1062,6 +1069,7 @@ def popular(type_, number, min=1, title=None):
'full_current_url',
'popular',
'debug_full_info',
'debug_full_info_as_list',
# imported into ckan.lib.helpers
'literal',
'link_to',
Expand Down

0 comments on commit abe5d3f

Please sign in to comment.