Patchwork [04,of,10,RFC] templatefilter: make stringify remove label wrappers

login
register
mail settings
Submitter Sean Farley
Date Dec. 21, 2012, 5:37 a.m.
Message ID <5c79792796ac3141f050.1356068274@laptop.local>
Download mbox | patch
Permalink /patch/237/
State Superseded
Headers show

Comments

Sean Farley - Dec. 21, 2012, 5:37 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1355961574 21600
# Node ID 5c79792796ac3141f0501d8e20d97b26dd8f5f4f
# Parent  19bea005cd095a81941820efcf5b924cc354d293
templatefilter: make stringify remove label wrappers

The first order of business is to make sure stringify returns only a string.

Patch

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -303,10 +303,11 @@ 
 
 def stringify(thing):
     """:stringify: Any type. Turns the value into text by converting values into
     text and concatenating them.
     """
+    thing, label = delabelify(thing)
     if util.safehasattr(thing, '__iter__') and not isinstance(thing, str):
         return "".join([stringify(t) for t in thing if t is not None])
     return str(thing)
 
 def strip(text):