From 407b15aeaefbb3e1f75234d4cf7cfe0afe1b91a9 Mon Sep 17 00:00:00 2001 From: Michel Blockelet Date: Thu, 29 Jul 2010 03:21:40 +0200 Subject: [PATCH] [mailman/Gui/SpamAssassin.py] Options SpamAssassin pour tout le monde Si les variables SpamAssassin ne sont pas initalisees pour la ML, on le fait avec les valeurs par defaut darcs-hash:20100729012140-ddb99-fc6c20b36a022da0f2643e13e115b17534dfa7c4.gz --- mailman/Gui/SpamAssassin.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mailman/Gui/SpamAssassin.py b/mailman/Gui/SpamAssassin.py index ac07e552..0ab93d71 100644 --- a/mailman/Gui/SpamAssassin.py +++ b/mailman/Gui/SpamAssassin.py @@ -24,14 +24,17 @@ from Mailman import Utils from Mailman.i18n import _ from Mailman.Gui.GUIBase import GUIBase +# Valeurs par defaut +default_hold = 2.1 +default_discard = 8 +default_member = 2 + try: True, False except NameError: True = 1 False = 0 - - class SpamAssassin(GUIBase): def GetConfigCategory(self): return 'spamassassin', _('SpamAssassin options...') @@ -39,9 +42,15 @@ class SpamAssassin(GUIBase): def GetConfigInfo(self, mlist, category, subcat=None): if category <> 'spamassassin': return None - if getattr(mlist,'SPAMASSASSIN_HOLD_SCORE',None)!=None and getattr(mlist,'SPAMASSASSIN_DISCARD_SCORE',None)!=None and getattr(mlist,'SPAMASSASSIN_MEMBER_BONUS',None)!=None : - return [('SPAMASSASSIN_HOLD_SCORE',mm_cfg.Number,7,0,_('''minimum SpamAssassin score before message moderation'''),_('''If the message have a SpamAssassin score higher than this value then it is moderate.''')), - ('SPAMASSASSIN_DISCARD_SCORE',mm_cfg.Number,7,0,_('''minimum SpamAssassin score before discarding the message'''),_('''If the message have a SpamAssass\in score higher than this value then it is discard.''')), - ('SPAMASSASSIN_MEMBER_BONUS',mm_cfg.Number,7,0,_('''Bonus score for message coming from a member of the list'''),_('''If the message come from a member of the list then the SpamAssassin score is lessen by the value.'''))] - else: - return [_("""This feature doesn't work yet with this list. Ask to the Nounou if you want this list to have this feature.""")] + + # Si la ML n'a pas de valeurs configurees, on initialise avec les valeurs par defaut + if (getattr(mlist,'SPAMASSASSIN_HOLD_SCORE',None)==None + or getattr(mlist,'SPAMASSASSIN_DISCARD_SCORE',None)==None + or getattr(mlist,'SPAMASSASSIN_MEMBER_BONUS',None)==None): + setattr(mlist, 'SPAMASSASSIN_HOLD_SCORE', default_hold) + setattr(mlist, 'SPAMASSASSIN_DISCARD_SCORE', default_discard) + setattr(mlist, 'SPAMASSASSIN_MEMBER_BONUS', default_member) + + return [('SPAMASSASSIN_HOLD_SCORE',mm_cfg.Number,7,0,_('''minimum SpamAssassin score before message moderation'''),_('''If the message have a SpamAssassin score higher than this value then it is deferred for moderation.''')), + ('SPAMASSASSIN_DISCARD_SCORE',mm_cfg.Number,7,0,_('''minimum SpamAssassin score before discarding the message'''),_('''If the message have a SpamAssassin score higher than this value then it is discard.''')), + ('SPAMASSASSIN_MEMBER_BONUS',mm_cfg.Number,7,0,_('''Bonus score for message coming from a member of the list'''),_('''If the message comes from a member of the list then the SpamAssassin score is lessen by the value.'''))]