Mercurial > p > roundup > code
comparison doc/customizing.txt @ 3830:a48c514c465f
Add simple anti-spam recipe to docs
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 25 Mar 2007 23:18:25 +0000 |
| parents | e5043875a03d |
| children | 6d14a3b4e295 |
comparison
equal
deleted
inserted
replaced
| 3829:d0ac8188d274 | 3830:a48c514c465f |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.217 $ | 5 :Version: $Revision: 1.218 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 3832 | 3832 |
| 3833 | 3833 |
| 3834 Changes to Tracker Behaviour | 3834 Changes to Tracker Behaviour |
| 3835 ---------------------------- | 3835 ---------------------------- |
| 3836 | 3836 |
| 3837 Preventing SPAM | |
| 3838 ~~~~~~~~~~~~~~~ | |
| 3839 | |
| 3840 The following detector code may be installed in your tracker's | |
| 3841 ``detectors`` directory. It will block any messages being created that | |
| 3842 have HTML attachments (a very common vector for spam and phishing) | |
| 3843 and any messages that have more than 2 HTTP URLs in them. Just copy | |
| 3844 the following into ``detectors/anti_spam.py`` in your tracker:: | |
| 3845 | |
| 3846 from roundup.exceptions import Reject | |
| 3847 | |
| 3848 def reject_html(db, cl, nodeid, newvalues): | |
| 3849 if newvalues['type'] == 'text/html': | |
| 3850 raise Reject, 'not allowed' | |
| 3851 | |
| 3852 def reject_manylinks(db, cl, nodeid, newvalues): | |
| 3853 content = newvalues['content'] | |
| 3854 if content.count('http://') > 2: | |
| 3855 raise Reject, 'not allowed' | |
| 3856 | |
| 3857 def init(db): | |
| 3858 db.file.audit('create', reject_html) | |
| 3859 db.msg.audit('create', reject_manylinks) | |
| 3860 | |
| 3861 You may also wish to block image attachments if your tracker does not | |
| 3862 need that ability:: | |
| 3863 | |
| 3864 if newvalues['type'].startswith('image/'): | |
| 3865 raise Reject, 'not allowed' | |
| 3866 | |
| 3867 | |
| 3837 Stop "nosy" messages going to people on vacation | 3868 Stop "nosy" messages going to people on vacation |
| 3838 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3869 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3839 | 3870 |
| 3840 When users go on vacation and set up vacation email bouncing, you'll | 3871 When users go on vacation and set up vacation email bouncing, you'll |
| 3841 start to see a lot of messages come back through Roundup "Fred is on | 3872 start to see a lot of messages come back through Roundup "Fred is on |
