changeset 591:eedd63b7cf42

debug: Don't show parentheses on redirected properties.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 17 Jan 2016 23:09:08 -0800
parents 3cca1f6bd610
children 9428bd0025eb
files piecrust/data/debug.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/data/debug.py	Sun Jan 17 23:08:40 2016 -0800
+++ b/piecrust/data/debug.py	Sun Jan 17 23:09:08 2016 -0800
@@ -309,9 +309,11 @@
             value = None
             render_name = name
             should_call = name in invoke_attrs
+            is_redirect = False
 
             if name in redirects:
                 name = redirects[name]
+                is_redirect = True
 
             query_instance = False
             try:
@@ -329,7 +331,10 @@
                 argcount = attr_func.__code__.co_argcount
                 var_names = attr_func.__code__.co_varnames
                 if argcount == 1 and should_call:
-                    render_name += '()'
+                    if not is_redirect:
+                        # Most of the time, redirects are for making a
+                        # property render better. So don't add parenthesis.
+                        render_name += '()'
                     value = attr_func()
                 else:
                     if should_call: