summaryrefslogtreecommitdiff
path: root/Mailman/Digester.py
diff options
context:
space:
mode:
authorbwarsaw2006-12-29 22:20:25 +0000
committerbwarsaw2006-12-29 22:20:25 +0000
commitf4a456a83b630feb294724ab462c87ca1ce1c3ae (patch)
treec5c88540dae8306d11671f603d8975b01803ea16 /Mailman/Digester.py
parentae185106a624bfa7888aa8722d35194d3c5150e8 (diff)
downloadmailman-f4a456a83b630feb294724ab462c87ca1ce1c3ae.tar.gz
mailman-f4a456a83b630feb294724ab462c87ca1ce1c3ae.tar.zst
mailman-f4a456a83b630feb294724ab462c87ca1ce1c3ae.zip
Diffstat (limited to 'Mailman/Digester.py')
-rw-r--r--Mailman/Digester.py51
1 files changed, 26 insertions, 25 deletions
diff --git a/Mailman/Digester.py b/Mailman/Digester.py
index 2d27b8442..98cb40dd3 100644
--- a/Mailman/Digester.py
+++ b/Mailman/Digester.py
@@ -1,50 +1,50 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""Mixin class with list-digest handling methods and settings."""
import os
-from stat import ST_SIZE
import errno
-from Mailman import mm_cfg
-from Mailman import Utils
from Mailman import Errors
+from Mailman import Utils
from Mailman.Handlers import ToDigest
+from Mailman.configuration import config
from Mailman.i18n import _
class Digester:
def InitVars(self):
- # Configurable
- self.digestable = mm_cfg.DEFAULT_DIGESTABLE
- self.digest_is_default = mm_cfg.DEFAULT_DIGEST_IS_DEFAULT
- self.mime_is_default_digest = mm_cfg.DEFAULT_MIME_IS_DEFAULT_DIGEST
- self.digest_size_threshhold = mm_cfg.DEFAULT_DIGEST_SIZE_THRESHHOLD
- self.digest_send_periodic = mm_cfg.DEFAULT_DIGEST_SEND_PERIODIC
- self.next_post_number = 1
- self.digest_header = mm_cfg.DEFAULT_DIGEST_HEADER
- self.digest_footer = mm_cfg.DEFAULT_DIGEST_FOOTER
- self.digest_volume_frequency = mm_cfg.DEFAULT_DIGEST_VOLUME_FREQUENCY
- # Non-configurable.
+ # Configurable
+ self.digestable = config.DEFAULT_DIGESTABLE
+ self.digest_is_default = config.DEFAULT_DIGEST_IS_DEFAULT
+ self.mime_is_default_digest = config.DEFAULT_MIME_IS_DEFAULT_DIGEST
+ self.digest_size_threshhold = config.DEFAULT_DIGEST_SIZE_THRESHHOLD
+ self.digest_send_periodic = config.DEFAULT_DIGEST_SEND_PERIODIC
+ self.next_post_number = 1
+ self.digest_header = config.DEFAULT_DIGEST_HEADER
+ self.digest_footer = config.DEFAULT_DIGEST_FOOTER
+ self.digest_volume_frequency = config.DEFAULT_DIGEST_VOLUME_FREQUENCY
+ # Non-configurable.
self.one_last_digest = {}
- self.digest_members = {}
- self.next_digest_number = 1
+ self.digest_members = {}
+ self.next_digest_number = 1
self.digest_last_sent_at = 0
def send_digest_now(self):
@@ -55,7 +55,7 @@ class Digester:
try:
mboxfp = None
# See if there's a digest pending for this mailing list
- if os.stat(digestmbox)[ST_SIZE] > 0:
+ if os.stat(digestmbox).st_size > 0:
mboxfp = open(digestmbox)
ToDigest.send_digests(self, mboxfp)
os.unlink(digestmbox)
@@ -63,10 +63,11 @@ class Digester:
if mboxfp:
mboxfp.close()
except OSError, e:
- if e.errno <> errno.ENOENT: raise
+ if e.errno <> errno.ENOENT:
+ raise
# List has no outstanding digests
- return 0
- return 1
+ return False
+ return True
def bump_digest_volume(self):
self.volume += 1