entity encoded email-address

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
@register.filter(name='secure_mail')
@stringfilter
def secure_mail(value):
    """
    Returns a somewhat safer email address
    
    Usage:
    
        {{ "mailto:me@domain.com"|secure_mail }}
    
    Outputs:
        
        mailto:me@domain.com
    
    """
    try:
        return "".join(["&#%s;" %(ord(c)) for c in value])
    except:
        return value
secure_mail.is_safe = True # because "&" is renderd with autoescape by default 

More like this

  1. encode_mailto by santuri 4 years, 9 months ago
  2. Email Munger by cootetom 3 years ago
  3. Encode emails as URIs by fahhem 1 year, 5 months ago
  4. Email obfuscation filter using ROT13 by worksology 2 years, 9 months ago
  5. AntiSpamModelForm by zenx 2 years, 1 month ago

Comments

(Forgotten your password?)