Ejemplo n.º 1
0
    def _process_monitoring_panel(self, req):
        req.perm.assert_permission('SPAM_TRAIN')

        filtersys = FilterSystem(self.env)

        if 'markspam' in req.args or 'markham' in req.args:
            spam = 'markspam' in req.args
            for entry_id in req.args.getlist('sel'):
                filtersys.train(req, entry_id, spam=spam)

        elif 'delete' in req.args:
            for entry_id in req.args.getlist('sel'):
                LogEntry.delete(self.env, entry_id)

        return True
Ejemplo n.º 2
0
 def delete(self, req, ids, stats):
     if not isinstance(ids, list):
         ids = [ids]
     if stats:
         for log_id in ids:
             entry = LogEntry.fetch(self.env, log_id)
             if entry:
                 type = "spam" if entry.rejected else "ham"
                 status = "delete"
                 for strategy in self.strategies:
                     count = entry.findreasonvalue(get_strategy_name(strategy))
                     if count:
                         spamstatus = count < 0
                         self._record_action(status, type, ("ok" if spamstatus == entry.rejected else "error"), strategy, 0)
                     else:
                         self._record_action(status, type, '', strategy, 0)
                 self._record_action(status, type, '', '', 0)
     LogEntry.delete(self.env, ids)