equal
deleted
inserted
replaced
352 |
352 |
353 @templatefilter('stringescape') |
353 @templatefilter('stringescape') |
354 def stringescape(text): |
354 def stringescape(text): |
355 return stringutil.escapestr(text) |
355 return stringutil.escapestr(text) |
356 |
356 |
357 @templatefilter('stringify') |
357 @templatefilter('stringify', intype=bytes) |
358 def stringify(thing): |
358 def stringify(thing): |
359 """Any type. Turns the value into text by converting values into |
359 """Any type. Turns the value into text by converting values into |
360 text and concatenating them. |
360 text and concatenating them. |
361 """ |
361 """ |
362 return templateutil.stringify(thing) |
362 return thing # coerced by the intype |
363 |
363 |
364 @templatefilter('stripdir') |
364 @templatefilter('stripdir') |
365 def stripdir(text): |
365 def stripdir(text): |
366 """Treat the text as path and strip a directory level, if |
366 """Treat the text as path and strip a directory level, if |
367 possible. For example, "foo" and "foo/bar" becomes "foo". |
367 possible. For example, "foo" and "foo/bar" becomes "foo". |