Ticket #11717: patch-11717.diff
File patch-11717.diff, 1.1 KB (added by , 15 years ago) |
---|
-
django/template/defaultfilters.py
862 862 return u"Error in formatting: %s" % force_unicode(e, errors="replace") 863 863 pprint.is_safe = True 864 864 865 def concat(value, arg, autoescape=None): 866 """ 867 Concats value with arg. 868 869 For example: {{ "this is"|concat:" a concatenated string." }} 870 """ 871 value = force_unicode(value) 872 if autoescape: 873 from django.utils.html import conditional_escape 874 value = conditional_escape(value) 875 try: 876 data = value + arg 877 except AttributeError: # fail silently but nicely 878 return value 879 return mark_safe(data) 880 concat.is_safe = True 881 concat.needs_autoescape = True 882 865 883 # Syntax: register.filter(name of filter, callback) 866 884 register.filter(add) 867 885 register.filter(addslashes) 868 886 register.filter(capfirst) 869 887 register.filter(center) 888 register.filter(concat) 870 889 register.filter(cut) 871 890 register.filter(date) 872 891 register.filter(default)