This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pygettext: non-standard timestamp format in POT-Creation-Date
Type: behavior Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barry, flipmcf, jwilk, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2013-06-03 20:51 by jwilk, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
iss18128.patch flipmcf, 2015-04-14 23:19 review
issue18128.patch flipmcf, 2015-04-15 19:05 review
Messages (10)
msg190563 - (view) Author: Jakub Wilk (jwilk) Date: 2013-06-03 20:51
pygettext uses non-standard timestamp format in the POT-Creation-Date field. For example:

POT-Creation-Date: 2013-06-03 22:31+CEST

whereas xgettext uses this format:

POT-Creation-Date: 2013-06-03 22:31+0200

You could use this code to generate timestamps in the same format as xgettext:

from time import time, localtime, strftime
from calendar import timegm

def gettext_timestamp():
    now = int(time())
    nowtuple = localtime(now)
    offset = timegm(nowtuple) - now
    sign = '-' if offset < 0 else '+'
    hour, minute = divmod(abs(offset) // 60, 60)
    return strftime('%Y-%m-%d %H:%M', nowtuple) + sign + '%02d%02d' % (hour, minute)
msg190564 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2013-06-03 20:54
It's probably worth changing.  My only concern would be backwards compatibility issues.
msg241025 - (view) Author: Michael McFadden (flipmcf) * Date: 2015-04-14 20:52
I'm going to be adding some tests around pygettext tool and then tackling this.
msg241055 - (view) Author: Michael McFadden (flipmcf) * Date: 2015-04-14 23:19
Patch File iss18128.patch adds test_i18n to start testing the entire Tools/i18n package, and has a very simple fix.
msg241144 - (view) Author: Michael McFadden (flipmcf) * Date: 2015-04-15 19:05
Post-review - new patch
msg241162 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-15 21:14
Barry, would you be OK with just applying this to 3.5?  We can add a porting note to whatsnew.  My guess, though, is that no one is going to notice.
msg241163 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-15 21:16
Oh, I forgot to say that the patch looks good to me.
msg241168 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2015-04-15 21:48
@rdm: I'm pretty sure you're right about nobody noticing. :)  Make it so!
msg241232 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-16 16:20
New changeset c969413584cf by R David Murray in branch 'default':
#18128: use standard +NNNN timezone format in POT-Creation-Date header.
https://hg.python.org/cpython/rev/c969413584cf
msg241233 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-16 16:21
Thanks, Michael.
History
Date User Action Args
2022-04-11 14:57:46adminsetgithub: 62328
2015-04-16 16:21:23r.david.murraysetstatus: open -> closed
versions: + Python 3.5
type: behavior
messages: + msg241233

resolution: fixed
stage: resolved
2015-04-16 16:20:23python-devsetnosy: + python-dev
messages: + msg241232
2015-04-15 21:48:01barrysetmessages: + msg241168
2015-04-15 21:16:48r.david.murraysetmessages: + msg241163
2015-04-15 21:14:28r.david.murraysetnosy: + r.david.murray
messages: + msg241162
2015-04-15 19:06:00flipmcfsetfiles: + issue18128.patch

messages: + msg241144
2015-04-14 23:19:16flipmcfsetfiles: + iss18128.patch
keywords: + patch
messages: + msg241055
2015-04-14 20:52:52flipmcfsetnosy: + flipmcf
messages: + msg241025
2013-06-03 20:54:38barrysetmessages: + msg190564
2013-06-03 20:53:49barrysetnosy: + barry
2013-06-03 20:51:02jwilkcreate