Roundup Tracker - Issues

Issue 1352624

classification
Wrong date creation in mailer.get_standard_message
Type: Severity: normal
Components: None Versions:
process
Status: closed
:
: : krzyg, richard
Priority: normal :

Created on 2005-11-09 22:30 by krzyg, last changed 2006-01-15 15:14 by krzyg.

Messages
msg2048 Author: [hidden] (krzyg) Date: 2005-11-09 22:30
In mailer.get_standard_message 'Date:' header field is
made without checking currnet locale. If default locale
of system is not 'C'
(eg. pl_PL) time.strftime returns incorrect data string.
msg2049 Author: [hidden] (richard) Date: 2006-01-13 02:07
Logged In: YES 
user_id=6405

I assume you mean that in pl_PL it returns a Polish (just 
guessing) version of the weekday / month strings? 
 
I *believe* that is valid, though I'm having trouble 
finding anything that makes the call one way or another. 
 
Certainly the RFC2822 spec clearly indicates that the 
strings to be used are the "C" locale equivalent strings. 
msg2050 Author: [hidden] (richard) Date: 2006-01-13 02:38
Logged In: YES 
user_id=6405

Fixed if email.Utils is available for import (python 2.2+) 
msg2051 Author: [hidden] (krzyg) Date: 2006-01-15 15:14
Logged In: YES 
user_id=1376167

After update i've got exception in email.Utils.formtdate.
I made a quick fix attached below. I'm new to python
so it could be invalid.

--- mailer.py   2006-01-15 15:44:48.000000000 +0100
+++ mailer.py.new       2006-01-15 16:12:34.000000000 +0100
@@ -15,7 +15,7 @@
     from email.Utils import formatdate
 except ImportError:
     def formatdate(timeval):
-        return time.strftime("%a, %d %b %Y %H:%M:%S +0000",
timeval)
+        return time.strftime("%a, %d %b %Y %H:%M:%S +0000",
time.gmtime())

 class MessageSendError(RuntimeError):
     pass
@@ -60,7 +60,7 @@
         writer.addheader('Subject', encode_header(subject,
charset))
         writer.addheader('To', ', '.join(to))
         writer.addheader('From', author)
-        writer.addheader('Date', formatdate(time.gmtime()))
+        writer.addheader('Date', formatdate())

         # Add a unique Roundup header to help filtering
         writer.addheader('X-Roundup-Name',
encode_header(tracker_name,
History
Date User Action Args
2005-11-09 22:30:52krzygcreate