Back to index

plone3  3.1.7
spamProtect.py
Go to the documentation of this file.
00001 ## Script (Python) "spamProtect"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=mailaddress=None, mailname=None, cssclass=None, cssid=None
00008 ##title=Returns a spam-protected mail address tag
00009 ##
00010 email = mailaddress.replace('@', '@').replace(':', ':')
00011 
00012 if mailname is None:
00013     mailname = email
00014 if cssid is None:
00015     cssid = ''
00016 else:
00017     cssid = ' id="%s"' % cssid
00018 if cssclass is None:
00019     cssclass = ''
00020 else:
00021     cssclass = ' class="%s"' % cssclass
00022 
00023 return '<a href="&#0109;ailto&#0058;' + email + '"' + cssclass + cssid + '>' + mailname + '</a>'