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

Assert fails when using `Z` (UTC) timezone #862

doekman opened this issue May 9, 2019 · 1 comment


2 participants
Copy link

commented May 9, 2019

assert groups['tz_hour'].startswith(('+', '-'))

Assert fails when using Z (UTC) timezone in a date in a html meta field. Stack trace:

  File "/Users/doeke/prj/ArchiBucket/apawa/source/apawa/utils/", line 69, in render_pdf_with_overlays
    pdf = main_doc.write_pdf()
  File "/Users/doeke/prj/ArchiBucket/apawa/venv/lib/python3.7/site-packages/weasyprint/", line 629, in write_pdf
    surface.set_metadata(key, _w3c_date_to_iso(value, attr))
  File "/Users/doeke/prj/ArchiBucket/apawa/venv/lib/python3.7/site-packages/weasyprint/", line 165, in _w3c_date_to_iso
    assert groups['tz_hour'].startswith(('+', '-'))

This ISO date doesn't fail:

<meta name="dcterms.created" content="2019-05-09T13:34:53.564031+00:00">

This ISO date makes the assert fail (this worked before I updated weasyprint):

<meta name="dcterms.created" content="2019-05-09T13:36:37.317089Z">

The Z as timezone should be perfectly legal. Is there a reason why a custom ISO-date parser is being used?

Related: #600

@liZe liZe added this to the 48 milestone May 14, 2019

@liZe liZe closed this in 840c4a6 May 14, 2019

@liZe liZe added the crash label May 14, 2019


This comment has been minimized.

Copy link

commented May 14, 2019

Thank you! It's fixed now, and a test has been added to avoid regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.