Skip to content

Commit 966f6ec

Browse files
author
Justus Pendleton
committed
Don't try to call time.tzset if it doesn't exist
A not terribly elegant solution to issue [SF#825643] which pointed out that the current code fails horribly on Windows :(
1 parent d3a4f6f commit 966f6ec

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

roundup/mailer.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Sending Roundup-specific mail over SMTP.
22
"""
33
__docformat__ = 'restructuredtext'
4-
# $Id: mailer.py,v 1.20 2007-09-20 19:42:48 jpend Exp $
4+
# $Id: mailer.py,v 1.21 2007-11-14 05:53:20 jpend Exp $
55

66
import time, quopri, os, socket, smtplib, re, sys, traceback
77

@@ -33,8 +33,13 @@ def __init__(self, config):
3333

3434
# set timezone so that things like formatdate(localtime=True)
3535
# use the configured timezone
36-
os.environ['TZ'] = get_timezone(self.config.TIMEZONE).tzname(None)
37-
time.tzset()
36+
# apparently tzset doesn't exist in python under Windows, my bad.
37+
# my pathetic attempts at googling a Windows-solution failed
38+
# so if you're on Windows your mail won't use your configured
39+
# timezone.
40+
if hasattr(time, 'tzset'):
41+
os.environ['TZ'] = get_timezone(self.config.TIMEZONE).tzname(None)
42+
time.tzset()
3843

3944
def get_standard_message(self, to, subject, author=None):
4045
'''Form a standard email message from Roundup.

0 commit comments

Comments
 (0)