Submitted by : simon at: 2003-10-26T21:32:15+00:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Hello,

after installing ZWiki-0-20-0 I got comment headers in the following form

From superuser
Wrom: QZUIVOTQN
Date: 2003/07/07 17:17 Westeuropäische Normalzeit

I tracked down the problem and it seems a date with a timezone containing 'Umlaute' are not accepted in DateTime() . As a workaround I changed 'ZWikiPage.py' line 1531 from:

time = zt.strftime('%Y/%m/%d %H:%M %Z')

to:

time = zt.rfc822()

a similar problem is in 'mail.py', so I changed line 394 from

msgid = time.strftime('%Y%m%d%H%M%S%Z@')

to:

msgid = time.strftime('%Y%m%d%H%M%S')+time.rfc822()[-5:]+'@'

How to eliminate addition? --Samotnik, 2003/07/21 18:34 GMT reply

It works great. However, for Poland, proper time is displayed with the additional + 2hours. How to eliminate this addition? (I'm not a programmer, and rfc protocol is also magic for me :( )

... --SimonMichael, 2003/07/29 04:00 GMT reply

Thanks. I suspect DateTime is working but python's UnixMailBox doesn't parse message headers containing unicode.

Is it legal RFC2822 to have non-ASCII characters in message headers ?

I expected %Z to always give a short standard 3-character timezone - are you sure what yours is doing is correct ?

I notice the python docs say %Z is deprecated. I think changing line 66 of the latest Messages.py to:

time = zt.strftime('%Y/%m/%d %H:%M %z')

(lower-case z) will give the same effect as your patch (always use the numeric offset, so that UnixMailBox won't have trouble). I'm a bit reluctant to do the same in Mail.py:messageIdFromTime() though, since it will make message urls harder to read.

How to eliminate addition? --SimonMichael, 2003/07/29 04:03 GMT reply

Samotnik - sorry I'm not sure, unless it's a matter of setting your timezone in UserOptions?.

PS --SimonMichael, 2003/07/29 04:13 GMT reply

This raises [#566 should message headings & urls use local timezone ?]?

First solution in the second place --Samotnik, 2003/07/29 13:54 GMT reply

Simon, Your solution didn't have an effect. It displayed exactly the same info, as I mentioned in http://zwiki.org/IssueNo0563CommentHeadingsInOtherLanguages

However, I replaced the line 66 in Messages.py to:

time = zt.rfc822()

as superuser sugested. It works well. Only for anonymous user nothing is displayed about the author of the comment.

As to my additional 2 hours, I will check User Options in ZMI.

property change --SimonMichael, 2003/08/01 22:03 GMT reply

Title: 'IssueNo0552? comment headers not formatted in certain timezones' => 'IssueNo0552? comment headers sometimes not formatted'

update --SimonMichael, 2003/08/04 18:32 GMT reply

I suspect this may be affecting a lot of people (everyone in certain timezones ? everyone on windows ?) I haven't checked in a fix because I don't know how to reproduce and don't understand what's going on, and I'm concerned with getting the most usable message permalink urls. Here's an update of the fix above for 0.21.1, if you need it (and please post if you did). Search for uses of strftime, there are two, in Messages.py and Mail.py. Change Messages.py's:

time = zt.strftime('%Y/%m/%d %H:%M %Z')

to:

time = zt.rfc822()

and Mail.py's:

msgid = time.strftime('%Y%m%d%H%M%S%Z@')

to:

msgid = time.strftime('%Y%m%d%H%M%S')+time.rfc822()[-5:]+'@'

testing it here --SimonMichael, Mon, 04 Aug 2003 18:40:36 +0000 reply

Question: does every time zone have an equivalent three-letter abbreviation ?

looks good, checked in for 0.22 --SimonMichael, Tue, 05 Aug 2003 04:30:06 +0000 reply

Status: open => closed