Ticket #2250: munge_email.diff
File munge_email.diff, 1.4 KB (added by , 18 years ago) |
---|
-
django/template/defaultfilters.py
63 63 """ 64 64 return list(str(value)) 65 65 66 def munge_email(value): 67 """Tries to hide email address from spambots. 68 69 Not handling unicode strings. 70 """ 71 if isinstance(value, str): 72 return ''.join('&#%d;' % ord(char) for char in value) 73 else: 74 return value 75 66 76 def slugify(value): 67 77 "Converts to lowercase, removes non-alpha chars and converts spaces to hyphens" 68 78 value = re.sub('[^\w\s-]', '', value).strip().lower() … … 485 495 register.filter(ljust) 486 496 register.filter(lower) 487 497 register.filter(make_list) 498 register.filter(munge_email) 488 499 register.filter(phone2numeric) 489 500 register.filter(pluralize) 490 501 register.filter(pprint) -
docs/templates.txt
938 938 Returns the value turned into a list. For an integer, it's a list of 939 939 digits. For a string, it's a list of characters. 940 940 941 munge_email 942 ~~~~~~~~~~ 943 944 Returns an encoded version of a string. Can be used to make it harder for 945 spambots to harvest e-mail addresses. For example, ``'a@b.com'`` gets 946 converted to ``'a@b.com'``. 947 941 948 phone2numeric 942 949 ~~~~~~~~~~~~~ 943 950