Permalink
Browse files

added an example for a custom keyword function

  • Loading branch information...
1 parent 10ae121 commit 1fcfb3a84834d766b0047b07a567fc3b099731c0 @coh2 coh2 committed Feb 14, 2012
Showing with 22 additions and 1 deletion.
  1. +22 −1 example/config.py
View
@@ -6,7 +6,28 @@
backend = MongoBackend(host='127.0.0.3', username='abc',
password='chngeme')
-keywords = ['foo', 'bar']
+
+def _my_awesome_kw_filter(text):
+ #TODO: investigate why the file-level re import doesn't seem to work
+ import re
+
+ res = []
+ tmp = re.search('username', text, re.I)
+ if tmp:
+ res.append(tmp.group())
+
+ tmp = re.search('password', text, re.I)
+ if tmp:
+ res.append(tmp.group())
+
+ tmp = re.search('p[0Oo]rn', text, re.I)
+ if tmp:
+ res = []
+
+ return None if 2 != len(res) else ','.join(res)
+
+
+keywords = ['foo', 'bar', _my_awesome_kw_filter]
listeners = [Mailer('foo@bar')]

0 comments on commit 1fcfb3a

Please sign in to comment.