Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygettext: non-standard timestamp format in POT-Creation-Date #62328

Closed
jwilk mannequin opened this issue Jun 3, 2013 · 10 comments
Closed

pygettext: non-standard timestamp format in POT-Creation-Date #62328

jwilk mannequin opened this issue Jun 3, 2013 · 10 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@jwilk
Copy link
Mannequin

jwilk mannequin commented Jun 3, 2013

BPO 18128
Nosy @warsaw, @jwilk, @bitdancer
Files
  • iss18128.patch
  • issue18128.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-04-16.16:21:23.458>
    created_at = <Date 2013-06-03.20:51:02.763>
    labels = ['type-bug']
    title = 'pygettext: non-standard timestamp format in POT-Creation-Date'
    updated_at = <Date 2015-04-16.16:21:23.456>
    user = 'https://github.com/jwilk'

    bugs.python.org fields:

    activity = <Date 2015-04-16.16:21:23.456>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-04-16.16:21:23.458>
    closer = 'r.david.murray'
    components = []
    creation = <Date 2013-06-03.20:51:02.763>
    creator = 'jwilk'
    dependencies = []
    files = ['39024', '39050']
    hgrepos = []
    issue_num = 18128
    keywords = ['patch']
    message_count = 10.0
    messages = ['190563', '190564', '241025', '241055', '241144', '241162', '241163', '241168', '241232', '241233']
    nosy_count = 5.0
    nosy_names = ['barry', 'jwilk', 'r.david.murray', 'python-dev', 'flipmcf']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18128'
    versions = ['Python 3.5']

    @jwilk
    Copy link
    Mannequin Author

    jwilk mannequin commented Jun 3, 2013

    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)

    @warsaw
    Copy link
    Member

    warsaw commented Jun 3, 2013

    It's probably worth changing. My only concern would be backwards compatibility issues.

    @flipmcf
    Copy link
    Mannequin

    flipmcf mannequin commented Apr 14, 2015

    I'm going to be adding some tests around pygettext tool and then tackling this.

    @flipmcf
    Copy link
    Mannequin

    flipmcf mannequin commented Apr 14, 2015

    Patch File iss18128.patch adds test_i18n to start testing the entire Tools/i18n package, and has a very simple fix.

    @flipmcf
    Copy link
    Mannequin

    flipmcf mannequin commented Apr 15, 2015

    Post-review - new patch

    @bitdancer
    Copy link
    Member

    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.

    @bitdancer
    Copy link
    Member

    Oh, I forgot to say that the patch looks good to me.

    @warsaw
    Copy link
    Member

    warsaw commented Apr 15, 2015

    @rdm: I'm pretty sure you're right about nobody noticing. :) Make it so!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 16, 2015

    New changeset c969413584cf by R David Murray in branch 'default':
    bpo-18128: use standard +NNNN timezone format in POT-Creation-Date header.
    https://hg.python.org/cpython/rev/c969413584cf

    @bitdancer
    Copy link
    Member

    Thanks, Michael.

    @bitdancer bitdancer added the type-bug An unexpected behavior, bug, or error label Apr 16, 2015
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants